Skip to content

Commit 31873db

Browse files
committed
clippy
1 parent e3e74c0 commit 31873db

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

misc/peer-store/src/connection_store.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl ConnectionStore {
4141
peer_id: &PeerId,
4242
connection_id: &ConnectionId,
4343
) -> bool {
44-
let connections = self.connected.entry(*peer_id).or_insert_with(HashSet::new);
44+
let connections = self.connected.entry(*peer_id).or_default();
4545
let is_first_connection = connections.is_empty();
4646
connections.insert(*connection_id);
4747
is_first_connection
@@ -55,11 +55,11 @@ impl ConnectionStore {
5555
connection_id: &ConnectionId,
5656
remaining_established: &usize,
5757
) -> bool {
58-
if let Some(connections) = self.connected.get_mut(&peer_id) {
59-
connections.remove(&connection_id);
58+
if let Some(connections) = self.connected.get_mut(peer_id) {
59+
connections.remove(connection_id);
6060

6161
if *remaining_established == 0 {
62-
self.connected.remove(&peer_id);
62+
self.connected.remove(peer_id);
6363
return true;
6464
}
6565
}
@@ -88,4 +88,4 @@ impl ConnectionStore {
8888
.map(|connections| connections.len())
8989
.unwrap_or(0)
9090
}
91-
}
91+
}

misc/peer-store/src/memory_store.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ use std::{
1313
num::NonZeroUsize,
1414
task::{Poll, Waker},
1515
};
16-
use std::collections::HashSet;
1716
use libp2p_core::{Multiaddr, PeerId};
18-
use libp2p_swarm::{behaviour::ConnectionEstablished, ConnectionClosed, ConnectionId, DialError, FromSwarm};
17+
use libp2p_swarm::{behaviour::ConnectionEstablished, ConnectionClosed, DialError, FromSwarm};
1918
use lru::LruCache;
2019
use tracing::{debug, trace};
2120
use crate::connection_store::ConnectionStore;
22-
use super::{connection_store, Store};
21+
use super::Store;
2322

2423
/// Event emitted from the [`MemoryStore`] to the [`Swarm`](libp2p_swarm::Swarm).
2524
#[derive(Debug, Clone)]

0 commit comments

Comments
 (0)