mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
Clean up sc-network (#9761)
* Clean up sc-network - Avoid using clone() for the Copy type `PeerId`. - Use `find_map` for `filter_map` and `next`. - Use `Self`. * More on Copy types * Cargo +nightly fmt --all * More .. * fmt * Revert vec![default_notif_handshake_message]
This commit is contained in:
@@ -78,7 +78,7 @@ impl NodeInfo {
|
||||
fn new(endpoint: ConnectedPoint) -> Self {
|
||||
let mut endpoints = SmallVec::new();
|
||||
endpoints.push(endpoint);
|
||||
NodeInfo { info_expire: None, endpoints, client_version: None, latest_ping: None }
|
||||
Self { info_expire: None, endpoints, client_version: None, latest_ping: None }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ impl PeerInfoBehaviour {
|
||||
Identify::new(cfg)
|
||||
};
|
||||
|
||||
PeerInfoBehaviour {
|
||||
Self {
|
||||
ping: Ping::new(PingConfig::new()),
|
||||
identify,
|
||||
nodes_info: FnvHashMap::default(),
|
||||
@@ -199,7 +199,7 @@ impl NetworkBehaviour for PeerInfoBehaviour {
|
||||
) {
|
||||
self.ping.inject_connection_established(peer_id, conn, endpoint);
|
||||
self.identify.inject_connection_established(peer_id, conn, endpoint);
|
||||
match self.nodes_info.entry(peer_id.clone()) {
|
||||
match self.nodes_info.entry(*peer_id) {
|
||||
Entry::Vacant(e) => {
|
||||
e.insert(NodeInfo::new(endpoint.clone()));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user