summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Orlenko <zxteam@protonmail.com>2022-10-09 14:01:04 +0100
committerAlex Orlenko <zxteam@protonmail.com>2022-10-09 14:08:33 +0100
commit29c6c9cb581b5b4a14bc0e7afaffadeaca0b0807 (patch)
tree0da2417a6c994b209bbd9803e80c297cc5c3a311
parente01af22bacb14580bb7fa494fc3ee3f2b043f5a1 (diff)
downloadmlua-29c6c9cb581b5b4a14bc0e7afaffadeaca0b0807.zip
Fix clippy warnings
-rw-r--r--src/function.rs7
-rw-r--r--src/hook.rs6
-rw-r--r--src/lua.rs4
3 files changed, 8 insertions, 9 deletions
diff --git a/src/function.rs b/src/function.rs
index dde2d32..8fb8d28 100644
--- a/src/function.rs
+++ b/src/function.rs
@@ -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);
}
diff --git a/src/hook.rs b/src/hook.rs
index f5f3082..59d67ae 100644
--- a/src/hook.rs
+++ b/src/hook.rs
@@ -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
}
}
diff --git a/src/lua.rs b/src/lua.rs
index e7bfe42..838c107 100644
--- a/src/lua.rs
+++ b/src/lua.rs
@@ -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) => {