From 8c4f9c077573e0e63330698eaba09795030beab0 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Thu, 7 Nov 2024 14:44:21 +0100 Subject: [PATCH] style(global): fix clippy suggestions (nightly) --- sn_networking/src/circular_vec.rs | 2 +- sn_networking/src/log_markers.rs | 2 +- sn_networking/src/record_store.rs | 2 +- sn_networking/src/target_arch.rs | 1 - sn_node/src/log_markers.rs | 2 +- sn_node_manager/src/local.rs | 6 +++--- sn_node_manager/tests/e2e.rs | 1 - sn_protocol/src/lib.rs | 8 ++++---- sn_service_management/src/auditor.rs | 2 +- sn_service_management/src/daemon.rs | 2 +- sn_service_management/src/faucet.rs | 2 +- sn_service_management/src/node.rs | 2 +- 12 files changed, 15 insertions(+), 17 deletions(-) diff --git a/sn_networking/src/circular_vec.rs b/sn_networking/src/circular_vec.rs index 0ef3aa0d24..bc7abb5acf 100644 --- a/sn_networking/src/circular_vec.rs +++ b/sn_networking/src/circular_vec.rs @@ -7,7 +7,7 @@ // permissions and limitations relating to use of the SAFE Network Software. /// Based on https://users.rust-lang.org/t/the-best-ring-buffer-library/58489/7 - +/// /// A circular buffer implemented with a VecDeque. #[derive(Debug)] pub(crate) struct CircularVec { diff --git a/sn_networking/src/log_markers.rs b/sn_networking/src/log_markers.rs index 38ec42c875..f803534342 100644 --- a/sn_networking/src/log_markers.rs +++ b/sn_networking/src/log_markers.rs @@ -31,7 +31,7 @@ pub enum Marker<'a> { FlaggedAsBadNode { flagged_by: &'a PeerId }, } -impl<'a> Marker<'a> { +impl Marker<'_> { /// Returns the string representation of the LogMarker. pub fn log(&self) { // Down the line, if some logs are noisier than others, we can diff --git a/sn_networking/src/record_store.rs b/sn_networking/src/record_store.rs index cb7ffca5c5..cb4b45e887 100644 --- a/sn_networking/src/record_store.rs +++ b/sn_networking/src/record_store.rs @@ -449,7 +449,7 @@ impl NodeRecordStore { match cipher.decrypt(&nonce, record.value.as_ref()) { Ok(value) => { record.value = value; - return Some(Cow::Owned(record)); + Some(Cow::Owned(record)) } Err(error) => { error!("Error while decrypting record. key: {key:?}: {error:?}"); diff --git a/sn_networking/src/target_arch.rs b/sn_networking/src/target_arch.rs index 35a1b62092..680528496a 100644 --- a/sn_networking/src/target_arch.rs +++ b/sn_networking/src/target_arch.rs @@ -10,7 +10,6 @@ pub use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; /// Wasm32 target arch does not support `time` or spawning via tokio /// so we shim in alternatives here when building for that architecture - #[cfg(not(target_arch = "wasm32"))] pub use tokio::{ spawn, diff --git a/sn_node/src/log_markers.rs b/sn_node/src/log_markers.rs index 0be204d38c..ac68e5ae89 100644 --- a/sn_node/src/log_markers.rs +++ b/sn_node/src/log_markers.rs @@ -62,7 +62,7 @@ pub enum Marker<'a> { IntervalBadNodesCheckTriggered, } -impl<'a> Marker<'a> { +impl Marker<'_> { /// Returns the string representation of the LogMarker. pub fn log(&self) { // Down the line, if some logs are noisier than others, we can diff --git a/sn_node_manager/src/local.rs b/sn_node_manager/src/local.rs index 5796cda354..97d0b9a716 100644 --- a/sn_node_manager/src/local.rs +++ b/sn_node_manager/src/local.rs @@ -521,9 +521,9 @@ pub async fn run_node( }) } -/// -/// Private Helpers -/// +// +// Private Helpers +// async fn validate_network(node_registry: &mut NodeRegistry, peers: Vec) -> Result<()> { let mut all_peers = node_registry diff --git a/sn_node_manager/tests/e2e.rs b/sn_node_manager/tests/e2e.rs index fd2973b8aa..8cc400685f 100644 --- a/sn_node_manager/tests/e2e.rs +++ b/sn_node_manager/tests/e2e.rs @@ -18,7 +18,6 @@ use std::path::PathBuf; /// /// They are assuming the existence of a `safenode` binary produced by the release process, and a /// running local network, with SAFE_PEERS set to a local node. - const CI_USER: &str = "runner"; #[cfg(unix)] const SAFENODE_BIN_NAME: &str = "safenode"; diff --git a/sn_protocol/src/lib.rs b/sn_protocol/src/lib.rs index f397173ca1..a9a0b3bbfc 100644 --- a/sn_protocol/src/lib.rs +++ b/sn_protocol/src/lib.rs @@ -307,7 +307,7 @@ pub struct PrettyPrintRecordKey<'a> { key: Cow<'a, RecordKey>, } -impl<'a> Serialize for PrettyPrintRecordKey<'a> { +impl Serialize for PrettyPrintRecordKey<'_> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -344,7 +344,7 @@ impl<'a> From<&'a RecordKey> for PrettyPrintRecordKey<'a> { } } -impl<'a> PrettyPrintRecordKey<'a> { +impl PrettyPrintRecordKey<'_> { /// Creates a owned version that can be then used to pass as error values. /// Do not call this if you just want to print/log `PrettyPrintRecordKey` pub fn into_owned(self) -> PrettyPrintRecordKey<'static> { @@ -369,7 +369,7 @@ impl<'a> PrettyPrintRecordKey<'a> { } } -impl<'a> std::fmt::Display for PrettyPrintRecordKey<'a> { +impl std::fmt::Display for PrettyPrintRecordKey<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let record_key_bytes = match &self.key { Cow::Borrowed(borrowed_key) => borrowed_key.as_ref(), @@ -388,7 +388,7 @@ impl<'a> std::fmt::Display for PrettyPrintRecordKey<'a> { } } -impl<'a> std::fmt::Debug for PrettyPrintRecordKey<'a> { +impl std::fmt::Debug for PrettyPrintRecordKey<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { // same as display write!(f, "{self}") diff --git a/sn_service_management/src/auditor.rs b/sn_service_management/src/auditor.rs index 66f00a0eb5..7df0bcb46c 100644 --- a/sn_service_management/src/auditor.rs +++ b/sn_service_management/src/auditor.rs @@ -43,7 +43,7 @@ impl<'a> AuditorService<'a> { } #[async_trait] -impl<'a> ServiceStateActions for AuditorService<'a> { +impl ServiceStateActions for AuditorService<'_> { fn bin_path(&self) -> PathBuf { self.service_data.auditor_path.clone() } diff --git a/sn_service_management/src/daemon.rs b/sn_service_management/src/daemon.rs index c617515fe5..0b3282ad60 100644 --- a/sn_service_management/src/daemon.rs +++ b/sn_service_management/src/daemon.rs @@ -44,7 +44,7 @@ impl<'a> DaemonService<'a> { } #[async_trait] -impl<'a> ServiceStateActions for DaemonService<'a> { +impl ServiceStateActions for DaemonService<'_> { fn bin_path(&self) -> PathBuf { self.service_data.daemon_path.clone() } diff --git a/sn_service_management/src/faucet.rs b/sn_service_management/src/faucet.rs index f1c3d8f952..097db24f6a 100644 --- a/sn_service_management/src/faucet.rs +++ b/sn_service_management/src/faucet.rs @@ -44,7 +44,7 @@ impl<'a> FaucetService<'a> { } #[async_trait] -impl<'a> ServiceStateActions for FaucetService<'a> { +impl ServiceStateActions for FaucetService<'_> { fn bin_path(&self) -> PathBuf { self.service_data.faucet_path.clone() } diff --git a/sn_service_management/src/node.rs b/sn_service_management/src/node.rs index d896aeb48d..9bc7297f39 100644 --- a/sn_service_management/src/node.rs +++ b/sn_service_management/src/node.rs @@ -50,7 +50,7 @@ impl<'a> NodeService<'a> { } #[async_trait] -impl<'a> ServiceStateActions for NodeService<'a> { +impl ServiceStateActions for NodeService<'_> { fn bin_path(&self) -> PathBuf { self.service_data.safenode_path.clone() }