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 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>>(&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) => {