@@ -24,7 +24,6 @@ use std::{
2424 collections:: VecDeque ,
2525 collections:: { BTreeSet , HashMap } ,
2626 fmt,
27- iter:: FromIterator ,
2827 net:: IpAddr ,
2928 sync:: Arc ,
3029 task:: { Context , Poll } ,
@@ -1246,7 +1245,7 @@ where
12461245 if self . explicit_peers . contains ( peer_id) {
12471246 warn ! ( "GRAFT: ignoring request from direct peer {}" , peer_id) ;
12481247 // this is possibly a bug from non-reciprocal configuration; send a PRUNE for all topics
1249- to_prune_topics = HashSet :: from_iter ( topics. into_iter ( ) ) ;
1248+ to_prune_topics = topics. into_iter ( ) . collect ( ) ;
12501249 // but don't PX
12511250 do_px = false
12521251 } else {
@@ -1779,15 +1778,12 @@ where
17791778
17801779 // if the mesh needs peers add the peer to the mesh
17811780 if !self . explicit_peers . contains ( propagation_source)
1782- && match self
1783- . connected_peers
1784- . get ( propagation_source)
1785- . map ( |v| & v. kind )
1786- {
1787- Some ( PeerKind :: Gossipsubv1_1 ) => true ,
1788- Some ( PeerKind :: Gossipsub ) => true ,
1789- _ => false ,
1790- }
1781+ && matches ! (
1782+ self . connected_peers
1783+ . get( propagation_source)
1784+ . map( |v| & v. kind) ,
1785+ Some ( PeerKind :: Gossipsubv1_1 ) | Some ( PeerKind :: Gossipsub )
1786+ )
17911787 && !Self :: score_below_threshold_from_scores (
17921788 & self . peer_score ,
17931789 propagation_source,
@@ -1860,7 +1856,7 @@ where
18601856 let topics_joined = topics_to_graft. iter ( ) . collect :: < Vec < _ > > ( ) ;
18611857 if !topics_joined. is_empty ( ) {
18621858 peer_added_to_mesh (
1863- propagation_source. clone ( ) ,
1859+ * propagation_source,
18641860 topics_joined,
18651861 & self . mesh ,
18661862 self . peer_topics . get ( propagation_source) ,
@@ -2426,7 +2422,7 @@ where
24262422 remaining_prunes. push ( prune) ;
24272423 // inform the handler
24282424 peer_removed_from_mesh (
2429- peer. clone ( ) ,
2425+ * peer,
24302426 topic_hash,
24312427 & self . mesh ,
24322428 self . peer_topics . get ( & peer) ,
@@ -2647,7 +2643,7 @@ where
26472643 // error and drop the message (all individual messages should be small enough to fit in the
26482644 // max_transmit_size)
26492645
2650- let messages = self . fragment_message ( message. into ( ) ) ?;
2646+ let messages = self . fragment_message ( message) ?;
26512647
26522648 for message in messages {
26532649 self . events
@@ -2803,7 +2799,7 @@ where
28032799 self . config . protocol_id_prefix ( ) . clone ( ) ,
28042800 self . config . max_transmit_size ( ) ,
28052801 self . config . validation_mode ( ) . clone ( ) ,
2806- self . config . idle_timeout ( ) . clone ( ) ,
2802+ self . config . idle_timeout ( ) ,
28072803 self . config . support_floodsub ( ) ,
28082804 )
28092805 }
@@ -3008,7 +3004,7 @@ where
30083004 if mesh_peers. contains ( peer_id) {
30093005 self . events
30103006 . push_back ( NetworkBehaviourAction :: NotifyHandler {
3011- peer_id : peer_id. clone ( ) ,
3007+ peer_id : * peer_id,
30123008 event : Arc :: new ( GossipsubHandlerIn :: JoinedMesh ) ,
30133009 handler : NotifyHandler :: One ( connections. connections [ 0 ] ) ,
30143010 } ) ;
0 commit comments