Explorar el Código

src/net: cargo fmt and clippy needless_borrow fix

dasman hace 2 años
padre
commit
d2844e43f0

+ 4 - 4
src/net/hosts/refinery.rs

@@ -109,12 +109,12 @@ impl GreylistRefinery {
                     }
 
                     // Don't refine nodes that we are already connected to.
-                    if self.p2p().exists(&url).await {
+                    if self.p2p().exists(url).await {
                         continue
                     }
 
                     // Don't refine nodes that we are trying to connect to.
-                    if !self.p2p().add_pending(&url).await {
+                    if !self.p2p().add_pending(url).await {
                         continue
                     }
 
@@ -123,7 +123,7 @@ impl GreylistRefinery {
                         greylist.remove(position);
 
                         // Remove connection from pending
-                        self.p2p().remove_pending(&url).await;
+                        self.p2p().remove_pending(url).await;
                         debug!(
                             target: "net::refinery",
                             "Peer {} is non-responsive. Removed from greylist", url,
@@ -142,7 +142,7 @@ impl GreylistRefinery {
                     hosts.greylist_remove(url, position).await;
 
                     // Remove connection from pending
-                    self.p2p().remove_pending(&url).await;
+                    self.p2p().remove_pending(url).await;
                 }
                 None => {
                     debug!(target: "net::refinery", "No matching greylist entries found. Cannot proceed with refinery");

+ 4 - 3
src/net/protocol/protocol_address.rs

@@ -48,7 +48,7 @@ use crate::Result;
 /// prioritize them first.
 ///
 /// 2. Then select nodes matching the requested transports from the
-/// whitelist. 
+/// whitelist.
 ///
 /// 3. Next select whitelist nodes that don't match our transports. We do
 /// this so that nodes share and propagate nodes of different transports,
@@ -167,7 +167,8 @@ impl ProtocolAddress {
             debug!(target: "net::protocol_address::handle_receive_get_addrs()",
             "Fetching whitelist entries with schemes");
             addrs.append(
-                &mut self.hosts
+                &mut self
+                    .hosts
                     .whitelist_fetch_n_random_with_schemes(
                         &get_addrs_msg.transports,
                         get_addrs_msg.max,
@@ -234,7 +235,7 @@ impl ProtocolAddress {
         let mut addrs = vec![];
         let inbound = self.p2p.session_inbound();
         for (addr, last_seen) in inbound.ping_self.addrs.lock().await.iter() {
-            addrs.push((addr.clone(), last_seen.clone()));
+            addrs.push((addr.clone(), *last_seen));
         }
 
         debug!(target: "net::protocol_address::send_my_addrs()",

+ 1 - 1
src/net/protocol/protocol_seed.rs

@@ -80,7 +80,7 @@ impl ProtocolSeed {
         let mut addrs = vec![];
         let inbound = self.p2p.session_inbound();
         for (addr, last_seen) in inbound.ping_self.addrs.lock().await.iter() {
-            addrs.push((addr.clone(), last_seen.clone()));
+            addrs.push((addr.clone(), *last_seen));
         }
 
         debug!(target: "net::protocol_seed::send_my_addrs()",

+ 1 - 1
src/net/session/inbound_session.rs

@@ -308,7 +308,7 @@ impl PingSelfProcess {
                     let mut addrs = self.addrs.lock().await;
 
                     if addrs.contains_key(addr) {
-                        let val = addrs.get_mut(&addr).unwrap();
+                        let val = addrs.get_mut(addr).unwrap();
                         *val = last_seen;
                     }
                     addrs.insert(addr.clone(), last_seen);