From 8ff38d2ec48936cdec9c00b8c3db204fbb1a7f78 Mon Sep 17 00:00:00 2001 From: Sam Andreae Date: Sat, 22 Jun 2024 11:55:06 +0100 Subject: [PATCH] Clippy --- aquadoggo/src/network/relay.rs | 2 +- aquadoggo/src/network/service.rs | 8 ++++---- aquadoggo/src/network/utils.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/aquadoggo/src/network/relay.rs b/aquadoggo/src/network/relay.rs index 39b1e2879..89f2dd74f 100644 --- a/aquadoggo/src/network/relay.rs +++ b/aquadoggo/src/network/relay.rs @@ -75,7 +75,7 @@ impl Relay { .unwrap() .register( rendezvous::Namespace::from_static(NODE_NAMESPACE), - self.peer_id.clone(), + self.peer_id, None, // Default ttl is 7200s )?; diff --git a/aquadoggo/src/network/service.rs b/aquadoggo/src/network/service.rs index 7bccafcc6..578f3012c 100644 --- a/aquadoggo/src/network/service.rs +++ b/aquadoggo/src/network/service.rs @@ -324,7 +324,7 @@ impl EventLoop { rendezvous_node, .. } => { - if let Some(relay) = self.relays.get_mut(&rendezvous_node) { + if let Some(relay) = self.relays.get_mut(rendezvous_node) { if !relay.registered { debug!("Registered on rendezvous {rendezvous_node} in namespace \"{namespace}\""); relay.registered = true; @@ -376,7 +376,7 @@ impl EventLoop { if let Some(addr) = is_known_peer_address(&mut self.network_config.relay_addresses, listen_addrs) { - if self.relays.get(peer_id).is_some() { + if self.relays.contains_key(peer_id) { return; } @@ -447,7 +447,7 @@ impl EventLoop { relay::client::Event::ReservationReqAccepted { relay_peer_id, .. } => { debug!("Relay {relay_peer_id} accepted circuit reservation request"); - if let Some(relay) = self.relays.get_mut(&relay_peer_id) { + if let Some(relay) = self.relays.get_mut(relay_peer_id) { relay.reservation_accepted = true; // Attempt to start discovering peers at the configured namespace. if relay.discover(&mut self.swarm) { @@ -497,7 +497,7 @@ impl EventLoop { ); // Remove this peer address from our known peers. - self.known_peers.remove(&endpoint.get_remote_address()); + self.known_peers.remove(endpoint.get_remote_address()); } event => trace!("{event:?}"), } diff --git a/aquadoggo/src/network/utils.rs b/aquadoggo/src/network/utils.rs index abc20f227..c9137120e 100644 --- a/aquadoggo/src/network/utils.rs +++ b/aquadoggo/src/network/utils.rs @@ -31,8 +31,8 @@ pub fn to_quic_address(address: &Multiaddr) -> Option { } pub fn is_known_peer_address( - known_addresses: &mut Vec, - peer_addresses: &Vec, + known_addresses: &mut [PeerAddress], + peer_addresses: &[Multiaddr], ) -> Option { for address in known_addresses.iter_mut() { if let Ok(addr) = address.quic_multiaddr() {