diff options
author | Alex Orlenko <zxteam@protonmail.com> | 2023-07-06 00:59:46 +0100 |
---|---|---|
committer | Alex Orlenko <zxteam@protonmail.com> | 2023-07-06 00:59:46 +0100 |
commit | 925a2816cc8d25aececb51534adcbbe0de1e23b3 (patch) | |
tree | ccf8e1270f4d193412a3b57cd0d2ca5a845c1230 /src/util | |
parent | b3b8d794460752b812375f881a6e01fb73db4012 (diff) | |
download | mlua-925a2816cc8d25aececb51534adcbbe0de1e23b3.zip |
clippy
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/mod.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/util/mod.rs b/src/util/mod.rs index 0526190..b497032 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -656,8 +656,6 @@ where Ok(Err(err)) => { ffi::lua_settop(state, 1); - let wrapped_error = ud as *mut WrappedFailure; - // Build `CallbackError` with traceback let traceback = if ffi::lua_checkstack(state, ffi::LUA_TRACEBACK_STACK) != 0 { ffi::luaL_traceback(state, state, ptr::null(), 0); @@ -668,10 +666,8 @@ where "<not enough stack space for traceback>".to_string() }; let cause = Arc::new(err); - ptr::write( - wrapped_error, - WrappedFailure::Error(Error::CallbackError { traceback, cause }), - ); + let wrapped_error = WrappedFailure::Error(Error::CallbackError { traceback, cause }); + ptr::write(ud, wrapped_error); get_gc_metatable::<WrappedFailure>(state); ffi::lua_setmetatable(state, -2); @@ -679,7 +675,7 @@ where } Err(p) => { ffi::lua_settop(state, 1); - ptr::write(ud as *mut WrappedFailure, WrappedFailure::Panic(Some(p))); + ptr::write(ud, WrappedFailure::Panic(Some(p))); get_gc_metatable::<WrappedFailure>(state); ffi::lua_setmetatable(state, -2); ffi::lua_error(state) |