mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 21:58:20 +00:00
Fixed lints
This commit is contained in:
@@ -27,7 +27,7 @@ impl<'a, T: Copy> Clone for WasmCell<'a, T> {
|
||||
impl<T: PartialEq + Copy> PartialEq for WasmCell<'_, T> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &WasmCell<T>) -> bool {
|
||||
true
|
||||
self.get() == other.get()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
8
lib/js-api/src/externals/function.rs
vendored
8
lib/js-api/src/externals/function.rs
vendored
@@ -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::<Store>().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<FT, F>(store: &Store, ty: FT, func: F) -> Self
|
||||
pub fn new<FT, F>(store: &Store, ty: FT, _func: F) -> Self
|
||||
where
|
||||
FT: Into<FunctionType>,
|
||||
F: Fn(&[Val]) -> Result<Vec<Val>, RuntimeError> + 'static + Send + Sync,
|
||||
@@ -212,7 +212,7 @@ impl Function {
|
||||
/// });
|
||||
/// ```
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
pub fn new_with_env<FT, F, Env>(store: &Store, ty: FT, env: Env, func: F) -> Self
|
||||
pub fn new_with_env<FT, F, Env>(_store: &Store, _ty: FT, _env: Env, _func: F) -> Self
|
||||
where
|
||||
FT: Into<FunctionType>,
|
||||
F: Fn(&Env, &[Val]) -> Result<Vec<Val>, RuntimeError> + 'static + Send + Sync,
|
||||
|
||||
19
lib/js-api/src/externals/table.rs
vendored
19
lib/js-api/src/externals/table.rs
vendored
@@ -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<Self, RuntimeError> {
|
||||
// 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<u32, RuntimeError> {
|
||||
pub fn grow(&self, _delta: u32, _init: Val) -> Result<u32, RuntimeError> {
|
||||
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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -133,7 +133,7 @@ impl Module {
|
||||
}
|
||||
|
||||
/// Creates a new WebAssembly module from a file path.
|
||||
pub fn from_file(store: &Store, file: impl AsRef<Path>) -> Result<Self, IoCompileError> {
|
||||
pub fn from_file(store: &Store, _file: impl AsRef<Path>) -> Result<Self, IoCompileError> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ impl Module {
|
||||
store: &Store,
|
||||
binary: &[u8],
|
||||
) -> Result<Self, CompileError> {
|
||||
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<Self, CompileError> {
|
||||
fn compile(_store: &Store, _binary: &[u8]) -> Result<Self, CompileError> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user