Fixed suggestions based on feedback

This commit is contained in:
Syrus 2020-04-16 13:45:16 -07:00
parent fbdfa62d3c
commit a2d2710010

View File

@ -39,11 +39,11 @@ wasmer_backends! {
); );
let state_bytes = { let state_bytes = {
let instance = module.instantiate(&import_object).unwrap(); let mut instance = module.instantiate(&import_object).unwrap();
let start: Func<(), ()> = instance.exports.get("_start").unwrap(); let start: Func<(), ()> = instance.exports.get("_start").unwrap();
start.call().unwrap(); start.call().unwrap();
let state = get_wasi_state(instance.context()); let state = get_wasi_state(instance.context_mut());
assert_eq!(state.args, args); assert_eq!(state.args, args);
assert_eq!(state.envs, envs); assert_eq!(state.envs, envs);
@ -63,8 +63,7 @@ wasmer_backends! {
assert_eq!(result, true as i32); assert_eq!(result, true as i32);
} }
#[allow(clippy::mut_from_ref)] pub(crate) fn get_wasi_state(ctx: &mut Ctx) -> &mut WasiState {
pub(crate) fn get_wasi_state(ctx: &Ctx) -> &mut WasiState { unsafe { state::get_wasi_state(ctx) }
unsafe { state::get_wasi_state(&mut *(ctx as *const Ctx as *mut Ctx)) }
} }
} }