From 845f6e66d79c9ad2dac14a12b81eff7af2d604ea Mon Sep 17 00:00:00 2001 From: sameh-farouk Date: Tue, 12 Sep 2023 13:53:32 +0300 Subject: [PATCH] refactor: apply clippy suggestions --- src/bins/rmb-peer.rs | 2 +- src/relay/federation/router.rs | 2 +- src/relay/ranker/mod.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bins/rmb-peer.rs b/src/bins/rmb-peer.rs index 140e4a3..2fc7b57 100644 --- a/src/bins/rmb-peer.rs +++ b/src/bins/rmb-peer.rs @@ -75,7 +75,7 @@ fn parse_urls(input: &[String]) -> Result> { let mut urls: Vec = Vec::new(); for s in input { - let u: url::Url = url::Url::parse(&s)?; + let u: url::Url = url::Url::parse(s)?; if u.domain().is_none() { anyhow::bail!("relay URL must contain a domain name"); } diff --git a/src/relay/federation/router.rs b/src/relay/federation/router.rs index e440d79..cfbc8cf 100644 --- a/src/relay/federation/router.rs +++ b/src/relay/federation/router.rs @@ -27,7 +27,7 @@ where pub fn new(sink: Sink, twins: D, ranker: RelayRanker) -> Self { Self { sink: Some(sink), - twins: twins, + twins, ranker, } } diff --git a/src/relay/ranker/mod.rs b/src/relay/ranker/mod.rs index 452757f..cea73c9 100644 --- a/src/relay/ranker/mod.rs +++ b/src/relay/ranker/mod.rs @@ -29,7 +29,7 @@ impl RelayStats { retain.saturating_add(Duration::from_secs(1)) }) < retain }); - log::trace!("cleaning {:?} entires", count - &self.failure_times.len()); + log::trace!("cleaning {:?} entires", count - self.failure_times.len()); } fn add_failure(&mut self, retain: Duration) { @@ -50,7 +50,7 @@ impl RelayStats { } count += 1; } - Ok(&self.failure_times.len() - count) + Ok(self.failure_times.len() - count) } /// Return the mean failure rate per hour based on the known failures happened during the specified recent period.