Fix clippy warnings

This commit is contained in:
Alex Orlenko 2022-10-09 14:01:04 +01:00
parent e01af22bac
commit 29c6c9cb58
No known key found for this signature in database
GPG key ID: 4C150C250863B96D
3 changed files with 8 additions and 9 deletions

View file

@ -277,9 +277,9 @@ impl<'lua> Function<'lua> {
short_src: ptr_to_cstr_bytes(ar.short_src.as_ptr()).map(|s| s.to_vec()),
#[cfg(feature = "luau")]
short_src: ptr_to_cstr_bytes(ar.short_src).map(|s| s.to_vec()),
line_defined: ar.linedefined as i32,
line_defined: ar.linedefined,
#[cfg(not(feature = "luau"))]
last_line_defined: ar.lastlinedefined as i32,
last_line_defined: ar.lastlinedefined,
}
}
}
@ -315,8 +315,7 @@ impl<'lua> Function<'lua> {
lua.push_ref(&self.0);
let data_ptr = &mut data as *mut Vec<u8> as *mut c_void;
let strip = if strip { 1 } else { 0 };
ffi::lua_dump(lua.state, writer, data_ptr, strip);
ffi::lua_dump(lua.state, writer, data_ptr, strip as i32);
ffi::lua_pop(lua.state, 1);
}

View file

@ -106,9 +106,9 @@ impl<'lua> Debug<'lua> {
short_src: ptr_to_cstr_bytes((*self.ar.get()).short_src.as_ptr()),
#[cfg(feature = "luau")]
short_src: ptr_to_cstr_bytes((*self.ar.get()).short_src),
line_defined: (*self.ar.get()).linedefined as i32,
line_defined: (*self.ar.get()).linedefined,
#[cfg(not(feature = "luau"))]
last_line_defined: (*self.ar.get()).lastlinedefined as i32,
last_line_defined: (*self.ar.get()).lastlinedefined,
what: ptr_to_cstr_bytes((*self.ar.get()).what),
}
}
@ -128,7 +128,7 @@ impl<'lua> Debug<'lua> {
"lua_getinfo failed with `l`"
);
(*self.ar.get()).currentline as i32
(*self.ar.get()).currentline
}
}

View file

@ -1124,7 +1124,7 @@ impl Lua {
#[cfg_attr(docsrs, doc(cfg(feature = "lua54")))]
pub fn warning<S: Into<Vec<u8>>>(&self, msg: S, tocont: bool) -> Result<()> {
let msg = CString::new(msg).map_err(|err| Error::RuntimeError(err.to_string()))?;
unsafe { ffi::lua_warning(self.state, msg.as_ptr(), if tocont { 1 } else { 0 }) };
unsafe { ffi::lua_warning(self.state, msg.as_ptr(), tocont as c_int) };
Ok(())
}
@ -2263,7 +2263,7 @@ impl Lua {
}
Value::Boolean(b) => {
ffi::lua_pushboolean(self.state, if b { 1 } else { 0 });
ffi::lua_pushboolean(self.state, b as c_int);
}
Value::LightUserData(ud) => {