Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
fitzgen committed Sep 25, 2023
1 parent 1929db6 commit 26d77cc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
5 changes: 2 additions & 3 deletions crates/wasmtime/src/externals/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ impl Global {
Val::F32(f) => *definition.as_u32_mut() = f,
Val::F64(f) => *definition.as_u64_mut() = f,
Val::FuncRef(f) => {
*definition.as_func_ref_mut() = f.map_or(ptr::null_mut(), |f| {
f.vm_func_ref(store).as_ptr().cast()
});
*definition.as_func_ref_mut() =
f.map_or(ptr::null_mut(), |f| f.vm_func_ref(store).as_ptr().cast());
}
Val::ExternRef(x) => {
let old = mem::replace(definition.as_externref_mut(), x.map(|x| x.inner));
Expand Down
4 changes: 1 addition & 3 deletions crates/wasmtime/src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,7 @@ impl Func {
/// this function is properly rooted within it. Additionally this function
/// should not be liberally used since it's a very low-level knob.
pub unsafe fn to_raw(&self, mut store: impl AsContextMut) -> *mut c_void {
self.vm_func_ref(store.as_context_mut().0)
.as_ptr()
.cast()
self.vm_func_ref(store.as_context_mut().0).as_ptr().cast()
}

/// Invokes this function with the `params` given, returning the results
Expand Down
5 changes: 2 additions & 3 deletions crates/wasmtime/src/trampoline/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ pub fn generate_global_export(
Val::F64(x) => *global.as_f64_bits_mut() = x,
Val::V128(x) => *global.as_u128_mut() = x.into(),
Val::FuncRef(f) => {
*global.as_func_ref_mut() = f.map_or(ptr::null_mut(), |f| {
f.vm_func_ref(store).as_ptr()
})
*global.as_func_ref_mut() =
f.map_or(ptr::null_mut(), |f| f.vm_func_ref(store).as_ptr())
}
Val::ExternRef(x) => *global.as_externref_mut() = x.map(|x| x.inner),
}
Expand Down
4 changes: 1 addition & 3 deletions crates/wasmtime/src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ impl Val {
if !f.comes_from_same_store(store) {
bail!("cross-`Store` values are not supported in tables");
}
Ok(TableElement::FuncRef(
f.vm_func_ref(store).as_ptr(),
))
Ok(TableElement::FuncRef(f.vm_func_ref(store).as_ptr()))
}
(Val::FuncRef(None), ValType::FuncRef) => Ok(TableElement::FuncRef(ptr::null_mut())),
(Val::ExternRef(Some(x)), ValType::ExternRef) => {
Expand Down

0 comments on commit 26d77cc

Please sign in to comment.