diff --git a/src/func.rs b/src/func.rs index d47afcae1a5d..ad47f8e9fd71 100644 --- a/src/func.rs +++ b/src/func.rs @@ -139,7 +139,7 @@ impl FuncInstance { args: &[RuntimeValue], externals: &mut E, ) -> Result, Trap> { - check_function_args(func.signature(), &args)?; + check_function_args(func.signature(), args)?; match *func.as_internal() { FuncInstanceInternal::Internal { .. } => { let mut interpreter = Interpreter::new(func, args, None)?; @@ -165,7 +165,7 @@ impl FuncInstance { externals: &mut E, stack_recycler: &mut StackRecycler, ) -> Result, Trap> { - check_function_args(func.signature(), &args)?; + check_function_args(func.signature(), args)?; match *func.as_internal() { FuncInstanceInternal::Internal { .. } => { let mut interpreter = Interpreter::new(func, args, Some(stack_recycler))?; diff --git a/src/memory/mod.rs b/src/memory/mod.rs index eaabe2488600..a46396cc9671 100644 --- a/src/memory/mod.rs +++ b/src/memory/mod.rs @@ -537,7 +537,7 @@ impl MemoryInstance { /// /// [`set`]: #method.get /// [`clear`]: #method.set - #[allow(clippy::clippy::needless_lifetimes)] + #[allow(clippy::needless_lifetimes)] pub fn direct_access<'a>(&'a self) -> impl AsRef<[u8]> + 'a { struct Buffer<'a>(Ref<'a, ByteBuf>); impl<'a> AsRef<[u8]> for Buffer<'a> { @@ -558,7 +558,7 @@ impl MemoryInstance { /// /// [`get`]: #method.get /// [`set`]: #method.set - #[allow(clippy::clippy::needless_lifetimes)] + #[allow(clippy::needless_lifetimes)] pub fn direct_access_mut<'a>(&'a self) -> impl AsMut<[u8]> + 'a { struct Buffer<'a>(RefMut<'a, ByteBuf>); impl<'a> AsMut<[u8]> for Buffer<'a> { diff --git a/src/nan_preserving_float.rs b/src/nan_preserving_float.rs index b062c8d52cab..b886fb1bff9d 100644 --- a/src/nan_preserving_float.rs +++ b/src/nan_preserving_float.rs @@ -96,6 +96,8 @@ macro_rules! float { } } + // clippy suggestion would fail some tests + #[allow(clippy::cmp_owned)] impl + Copy> PartialEq for $for { fn eq(&self, other: &T) -> bool { $is::from(*self) == $is::from((*other).into()) diff --git a/src/prepare/compile.rs b/src/prepare/compile.rs index e8410b403671..05104b0f0ffd 100644 --- a/src/prepare/compile.rs +++ b/src/prepare/compile.rs @@ -1246,7 +1246,7 @@ impl Sink { // Patch all relocations that was previously recorded for this // particular label. - let unresolved_rels = mem::replace(&mut self.labels[label.0].1, Vec::new()); + let unresolved_rels = mem::take(&mut self.labels[label.0].1); for reloc in unresolved_rels { self.ins.patch_relocation(reloc, dst_pc); } diff --git a/src/types.rs b/src/types.rs index 2e26bcde077b..e2cae8986859 100644 --- a/src/types.rs +++ b/src/types.rs @@ -49,7 +49,7 @@ impl Signature { /// Returns parameter types of this signature. pub fn params(&self) -> &[ValueType] { - &self.params.as_ref() + self.params.as_ref() } /// Returns return type of this signature. diff --git a/tests/spec/run.rs b/tests/spec/run.rs index d5d72571882b..12c9f52741fc 100644 --- a/tests/spec/run.rs +++ b/tests/spec/run.rs @@ -491,7 +491,7 @@ fn try_spec(name: &str) -> Result<(), Error> { for err in errors { write!(out, "{}", err).expect("Error formatting errors"); } - panic!(out); + panic!("{}", out); } Ok(()) diff --git a/validation/src/func.rs b/validation/src/func.rs index 7e041fe75913..ee30e81075ff 100644 --- a/validation/src/func.rs +++ b/validation/src/func.rs @@ -96,7 +96,7 @@ pub fn drive( } let mut context = FunctionValidationContext::new( - &module, + module, Locals::new(params, body.locals())?, DEFAULT_VALUE_STACK_LIMIT, DEFAULT_FRAME_STACK_LIMIT, @@ -237,6 +237,8 @@ impl<'a> FunctionValidationContext<'a> { top.block_type }; + // Ignore clippy as pop(..) != pop(..) + push_value(..) under some conditions + #[allow(clippy::branches_sharing_code)] if self.frame_stack.len() == 1 { // We are about to close the last frame. @@ -860,7 +862,7 @@ impl<'a> FunctionValidationContext<'a> { &self.frame_stack, StackValueType::Any, )?; - if StackValueType::from(local_type) != value_type { + if local_type != value_type { return Err(Error(format!( "Trying to update local {} of type {:?} with value of type {:?}", index, local_type, value_type diff --git a/validation/src/lib.rs b/validation/src/lib.rs index 88c18b14dd1c..75363d7ac076 100644 --- a/validation/src/lib.rs +++ b/validation/src/lib.rs @@ -126,7 +126,7 @@ impl FuncValidator for PlainFuncValidator { pub fn validate_module(module: &Module) -> Result { let mut context_builder = ModuleContextBuilder::new(); let mut imported_globals = Vec::new(); - let mut validation = V::new(&module); + let mut validation = V::new(module); // Copy types from module as is. context_builder.set_types( @@ -311,7 +311,7 @@ pub fn validate_module(module: &Module) -> Result(module: &Module) -> Result