Skip to content

Commit

Permalink
Merge pull request #2401 from b-zee/style-clippy-fixes
Browse files Browse the repository at this point in the history
style(global): fix clippy suggestions (nightly)
  • Loading branch information
b-zee authored Nov 8, 2024
2 parents 737a6e5 + 88b5400 commit df7fd13
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion sn_networking/src/circular_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> {
Expand Down
2 changes: 1 addition & 1 deletion sn_networking/src/log_markers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sn_networking/src/record_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}");
Expand Down
1 change: 0 additions & 1 deletion sn_networking/src/target_arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion sn_node/src/log_markers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions sn_node_manager/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ pub async fn run_node(
})
}

///
/// Private Helpers
///
//
// Private Helpers
//

async fn validate_network(node_registry: &mut NodeRegistry, peers: Vec<Multiaddr>) -> Result<()> {
let mut all_peers = node_registry
Expand Down
1 change: 0 additions & 1 deletion sn_node_manager/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions sn_protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ pub struct PrettyPrintRecordKey<'a> {
key: Cow<'a, RecordKey>,
}

impl<'a> Serialize for PrettyPrintRecordKey<'a> {
impl Serialize for PrettyPrintRecordKey<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand Down Expand Up @@ -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> {
Expand All @@ -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(),
Expand All @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion sn_service_management/src/auditor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion sn_service_management/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion sn_service_management/src/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion sn_service_management/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit df7fd13

Please sign in to comment.