diff options
author | Alex Auvolat <alex@adnab.me> | 2021-10-12 13:28:57 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-10-12 13:28:57 +0200 |
commit | 940750b5db494b207c0c4da0675f8b68cd1d7a6b (patch) | |
tree | 3156a899efb88d7282497ee22bd405c2dc38ce51 /src | |
parent | 74e661febe14e165349497bca689a50c5edacc94 (diff) | |
download | netapp-940750b5db494b207c0c4da0675f8b68cd1d7a6b.tar.gz netapp-940750b5db494b207c0c4da0675f8b68cd1d7a6b.zip |
fix clippy on basalt code
Diffstat (limited to 'src')
-rw-r--r-- | src/peering/basalt.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/peering/basalt.rs b/src/peering/basalt.rs index abfe1e4..a53571e 100644 --- a/src/peering/basalt.rs +++ b/src/peering/basalt.rs @@ -52,6 +52,7 @@ impl Peer { fn cost(&self, seed: &Seed) -> Cost { let mut hasher = hash::State::new(); hasher.update(&seed[..]); + let hasher = hasher; let mut cost = [0u8; 40]; match self.addr { @@ -59,7 +60,7 @@ impl Peer { let v4ip = v4addr.ip().octets(); for i in 0..4 { - let mut h = hasher.clone(); + let mut h = hasher; h.update(&v4ip[..i + 1]); cost[i * 8..(i + 1) * 8].copy_from_slice(&h.finalize()[..8]); } @@ -68,7 +69,7 @@ impl Peer { let v6ip = v6addr.ip().octets(); for i in 0..4 { - let mut h = hasher.clone(); + let mut h = hasher; h.update(&v6ip[..i + 2]); cost[i * 8..(i + 1) * 8].copy_from_slice(&h.finalize()[..8]); } @@ -76,7 +77,7 @@ impl Peer { } { - let mut h5 = hasher.clone(); + let mut h5 = hasher; h5.update(&format!("{} {}", self.addr, hex::encode(self.id)).into_bytes()[..]); cost[32..40].copy_from_slice(&h5.finalize()[..8]); } @@ -115,8 +116,7 @@ impl BasaltView { fn current_peers(&self) -> HashSet<Peer> { self.slots .iter() - .filter(|s| s.peer.is_some()) - .map(|s| s.peer.unwrap().clone()) + .filter_map(|s| s.peer) .collect::<HashSet<_>>() } fn current_peers_vec(&self) -> Vec<Peer> { @@ -131,7 +131,7 @@ impl BasaltView { .filter(|(_i, s)| s.peer.is_some()) .map(|(i, _s)| i) .collect::<Vec<_>>(); - if possibles.len() == 0 { + if possibles.is_empty() { vec![] } else { let mut ret = vec![]; @@ -290,7 +290,7 @@ impl Basalt { let basalt2 = basalt.clone(); netapp.add_msg_handler::<PushMessage, _, _>(move |_from: NodeID, push_msg: PushMessage| { basalt2.handle_peer_list(&push_msg.peers[..]); - async move { () } + async move { } }); basalt |