diff --git a/lib/js-api/src/cell.rs b/lib/js-api/src/cell.rs index a739315f7..08df7bc22 100644 --- a/lib/js-api/src/cell.rs +++ b/lib/js-api/src/cell.rs @@ -27,7 +27,7 @@ impl<'a, T: Copy> Clone for WasmCell<'a, T> { impl PartialEq for WasmCell<'_, T> { #[inline] fn eq(&self, other: &WasmCell) -> bool { - true + self.get() == other.get() } } diff --git a/lib/js-api/src/export.rs b/lib/js-api/src/export.rs index 8ce3e6f1c..5f7265c6c 100644 --- a/lib/js-api/src/export.rs +++ b/lib/js-api/src/export.rs @@ -95,7 +95,6 @@ impl Export { Export::Memory(js_wasm_memory) => js_wasm_memory.memory.as_ref(), Export::Function(js_func) => js_func.function.as_ref(), Export::Table(js_wasm_table) => js_wasm_table.table.as_ref(), - _ => unimplemented!(), } } } diff --git a/lib/js-api/src/exports.rs b/lib/js-api/src/exports.rs index d74c43296..22ddef593 100644 --- a/lib/js-api/src/exports.rs +++ b/lib/js-api/src/exports.rs @@ -173,7 +173,7 @@ impl Exports { Rets: WasmTypeList, T: ExportableWithGenerics<'a, Args, Rets>, { - let mut out: T = self.get_with_generics(name)?; + let out: T = self.get_with_generics(name)?; Ok(out) } diff --git a/lib/js-api/src/externals/function.rs b/lib/js-api/src/externals/function.rs index fbae5bf29..d6260c72e 100644 --- a/lib/js-api/src/externals/function.rs +++ b/lib/js-api/src/externals/function.rs @@ -41,7 +41,7 @@ pub struct Function { impl wasmer_types::WasmValueType for Function { /// Write the value. - unsafe fn write_value_to(&self, p: *mut i128) { + unsafe fn write_value_to(&self, _p: *mut i128) { // let func_ref = // Val::into_vm_funcref(&Val::FuncRef(Some(self.clone())), &self.store).unwrap(); // std::ptr::write(p as *mut VMFuncRef, func_ref); @@ -51,7 +51,7 @@ impl wasmer_types::WasmValueType for Function { /// Read the value. // TODO(reftypes): this entire function should be cleaned up, `dyn Any` should // ideally be removed - unsafe fn read_value_from(store: &dyn std::any::Any, p: *const i128) -> Self { + unsafe fn read_value_from(_store: &dyn std::any::Any, _p: *const i128) -> Self { unimplemented!(); // let func_ref = std::ptr::read(p as *const VMFuncRef); // let store = store.downcast_ref::().expect("Store expected in `Function::read_value_from`. If you see this error message it likely means you're using a function ref in a place we don't yet support it -- sorry about the inconvenience."); @@ -146,7 +146,7 @@ impl Function { /// }); /// ``` #[allow(clippy::cast_ptr_alignment)] - pub fn new(store: &Store, ty: FT, func: F) -> Self + pub fn new(store: &Store, ty: FT, _func: F) -> Self where FT: Into, F: Fn(&[Val]) -> Result, RuntimeError> + 'static + Send + Sync, @@ -212,7 +212,7 @@ impl Function { /// }); /// ``` #[allow(clippy::cast_ptr_alignment)] - pub fn new_with_env(store: &Store, ty: FT, env: Env, func: F) -> Self + pub fn new_with_env(_store: &Store, _ty: FT, _env: Env, _func: F) -> Self where FT: Into, F: Fn(&Env, &[Val]) -> Result, RuntimeError> + 'static + Send + Sync, diff --git a/lib/js-api/src/externals/table.rs b/lib/js-api/src/externals/table.rs index c8ce046e2..287764322 100644 --- a/lib/js-api/src/externals/table.rs +++ b/lib/js-api/src/externals/table.rs @@ -44,13 +44,6 @@ impl Table { /// This function will construct the `Table` using the store /// [`BaseTunables`][crate::tunables::BaseTunables]. pub fn new(store: &Store, ty: TableType, init: Val) -> Result { - // let item = init.into_table_reference(store)?; - // let tunables = store.tunables(); - // let style = tunables.table_style(&ty); - // let table = tunables - // .create_host_table(&ty, &style) - // .map_err(RuntimeError::new)?; - let descriptor = js_sys::Object::new(); js_sys::Reflect::set(&descriptor, &"initial".into(), &ty.minimum.into()); if let Some(max) = ty.maximum { @@ -114,7 +107,7 @@ impl Table { /// # Errors /// /// Returns an error if the `delta` is out of bounds for the table. - pub fn grow(&self, delta: u32, init: Val) -> Result { + pub fn grow(&self, _delta: u32, _init: Val) -> Result { unimplemented!(); // let item = init.into_table_reference(&self.store)?; // self.vm_table @@ -131,11 +124,11 @@ impl Table { /// Returns an error if the range is out of bounds of either the source or /// destination tables. pub fn copy( - dst_table: &Self, - dst_index: u32, - src_table: &Self, - src_index: u32, - len: u32, + _dst_table: &Self, + _dst_index: u32, + _src_table: &Self, + _src_index: u32, + _len: u32, ) -> Result<(), RuntimeError> { unimplemented!(); // if !Store::same(&dst_table.store, &src_table.store) { diff --git a/lib/js-api/src/instance.rs b/lib/js-api/src/instance.rs index f2d7f15b9..f75cba9d1 100644 --- a/lib/js-api/src/instance.rs +++ b/lib/js-api/src/instance.rs @@ -131,7 +131,7 @@ impl Instance { instance: instance, exports, }; - for mut func in functions { + for func in functions { func.init_envs(&self_instance); } Ok(self_instance) diff --git a/lib/js-api/src/module.rs b/lib/js-api/src/module.rs index 7f3945530..7c853db40 100644 --- a/lib/js-api/src/module.rs +++ b/lib/js-api/src/module.rs @@ -133,7 +133,7 @@ impl Module { } /// Creates a new WebAssembly module from a file path. - pub fn from_file(store: &Store, file: impl AsRef) -> Result { + pub fn from_file(store: &Store, _file: impl AsRef) -> Result { unimplemented!(); } @@ -158,7 +158,7 @@ impl Module { store: &Store, binary: &[u8], ) -> Result { - let js_bytes = unsafe { Uint8Array::view(binary) }; + let js_bytes = Uint8Array::view(binary); let module = WebAssembly::Module::new(&js_bytes.into()).unwrap(); // The module is now validated, so we can safely parse it's types @@ -202,7 +202,7 @@ impl Module { } } - fn compile(store: &Store, binary: &[u8]) -> Result { + fn compile(_store: &Store, _binary: &[u8]) -> Result { unimplemented!(); } diff --git a/lib/js-api/src/module_info_polyfill.rs b/lib/js-api/src/module_info_polyfill.rs index b81d7f665..3e2d9ffe1 100644 --- a/lib/js-api/src/module_info_polyfill.rs +++ b/lib/js-api/src/module_info_polyfill.rs @@ -582,13 +582,10 @@ pub fn parse_global_section( module_info.reserve_globals(globals.get_count())?; for entry in globals { - let wasmparser::Global { - ty: WPGlobalType { - content_type, - mutable, - }, - init_expr, - } = entry.map_err(transform_err)?; + let WPGlobalType { + content_type, + mutable, + } = entry.map_err(transform_err)?.ty; let global = GlobalType { ty: wptype_to_type(content_type).unwrap(), mutability: mutable.into(), @@ -654,7 +651,7 @@ pub fn parse_name_section<'data>( ) -> WasmResult<()> { while let Ok(subsection) = names.read() { match subsection { - wasmparser::Name::Function(function_subsection) => { + wasmparser::Name::Function(_function_subsection) => { // if let Some(function_names) = function_subsection // .get_map() // .ok() diff --git a/lib/js-api/src/store.rs b/lib/js-api/src/store.rs index ed34094f0..5ad8c3b32 100644 --- a/lib/js-api/src/store.rs +++ b/lib/js-api/src/store.rs @@ -22,7 +22,7 @@ impl Store { /// Checks whether two stores are identical. A store is considered /// equal to another store if both have the same engine. The /// tunables are excluded from the logic. - pub fn same(a: &Self, b: &Self) -> bool { + pub fn same(_a: &Self, _b: &Self) -> bool { true } } @@ -53,7 +53,7 @@ impl fmt::Debug for Store { /// A trait represinting any object that lives in the `Store`. pub trait StoreObject { /// Return true if the object `Store` is the same as the provided `Store`. - fn comes_from_same_store(&self, store: &Store) -> bool { + fn comes_from_same_store(&self, _store: &Store) -> bool { true } }