From 40ae438cf24e19a79766740509dd1d2ebaf03803 Mon Sep 17 00:00:00 2001 From: playX18 <158266309+playX18@users.noreply.github.com> Date: Thu, 24 Oct 2024 00:03:01 +0700 Subject: [PATCH] refactor(gstd,utils,runtime-interface): get rid of uncecessary clippy lints (#4305) Co-authored-by: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> --- gstd/src/prelude.rs | 2 +- runtime-interface/sandbox/src/detail.rs | 6 ++---- utils/gring/src/keyring.rs | 1 - utils/gring/src/keystore.rs | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/gstd/src/prelude.rs b/gstd/src/prelude.rs index ee7a1ee6a76..6b45123eb5a 100644 --- a/gstd/src/prelude.rs +++ b/gstd/src/prelude.rs @@ -61,7 +61,7 @@ pub mod collections { /// /// [`alloc::ffi`]: ::alloc::ffi pub mod ffi { - pub use ::alloc::ffi::*; + pub use ::alloc::ffi::{CString, FromVecWithNulError, IntoStringError, NulError}; pub use core::ffi::*; } diff --git a/runtime-interface/sandbox/src/detail.rs b/runtime-interface/sandbox/src/detail.rs index 68ca0fd5792..647b0b76d1e 100644 --- a/runtime-interface/sandbox/src/detail.rs +++ b/runtime-interface/sandbox/src/detail.rs @@ -73,7 +73,6 @@ struct SupervisorContext<'a, 'b> { } impl<'a, 'b> sandbox_env::SupervisorContext for SupervisorContext<'a, 'b> { - #[allow(clippy::needless_borrows_for_generic_args)] fn invoke( &mut self, invoke_args_ptr: Pointer, @@ -82,7 +81,7 @@ impl<'a, 'b> sandbox_env::SupervisorContext for SupervisorContext<'a, 'b> { ) -> gear_sandbox_host::error::Result { let mut ret_vals = [Val::null()]; let result = self.dispatch_thunk.call( - &mut self.caller, + &mut *self.caller, &[ Val::I32(u32::from(invoke_args_ptr) as i32), Val::I32(invoke_args_len as i32), @@ -479,7 +478,6 @@ pub fn memory_new(context: &mut dyn FunctionContext, initial: u32, maximum: u32) method_result } -#[allow(clippy::needless_borrows_for_generic_args)] pub fn memory_set( context: &mut dyn FunctionContext, memory_idx: u32, @@ -494,7 +492,7 @@ pub fn memory_set( sp_wasm_interface::with_caller_mut(context, |caller| { trace("memory_set", caller); - let Ok(buffer) = read_memory(&caller, val_ptr, val_len) else { + let Ok(buffer) = read_memory(&mut *caller, val_ptr, val_len) else { method_result = sandbox_env::env::ERR_OUT_OF_BOUNDS; return; }; diff --git a/utils/gring/src/keyring.rs b/utils/gring/src/keyring.rs index ab1caaa0fd9..822bb7e55b2 100644 --- a/utils/gring/src/keyring.rs +++ b/utils/gring/src/keyring.rs @@ -76,7 +76,6 @@ impl Keyring { } /// Update and get the primary key. - #[allow(clippy::assigning_clones)] pub fn primary(&mut self) -> Result { if self.ring.is_empty() { return Err(anyhow!( diff --git a/utils/gring/src/keystore.rs b/utils/gring/src/keystore.rs index 36a3c7bbdd1..a9a499a43b8 100644 --- a/utils/gring/src/keystore.rs +++ b/utils/gring/src/keystore.rs @@ -137,7 +137,6 @@ impl Keystore { } /// Returns self with the given name in meta. - #[allow(clippy::assigning_clones)] pub fn with_name(mut self, name: &str) -> Self { self.meta.name = name.to_owned(); self