Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
sandreae committed Jun 22, 2024
1 parent b8e7991 commit 8ff38d2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion aquadoggo/src/network/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)?;

Expand Down
8 changes: 4 additions & 4 deletions aquadoggo/src/network/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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:?}"),
}
Expand Down
4 changes: 2 additions & 2 deletions aquadoggo/src/network/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ pub fn to_quic_address(address: &Multiaddr) -> Option<SocketAddr> {
}

pub fn is_known_peer_address(
known_addresses: &mut Vec<PeerAddress>,
peer_addresses: &Vec<Multiaddr>,
known_addresses: &mut [PeerAddress],
peer_addresses: &[Multiaddr],
) -> Option<Multiaddr> {
for address in known_addresses.iter_mut() {
if let Ok(addr) = address.quic_multiaddr() {
Expand Down

0 comments on commit 8ff38d2

Please sign in to comment.