From 4325bc596f19665129fa5300641579fa05b87913 Mon Sep 17 00:00:00 2001 From: Ori Newman Date: Sun, 7 Jan 2024 19:43:15 +0200 Subject: [PATCH] Remove redundant collect --- protocol/p2p/src/core/hub.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/protocol/p2p/src/core/hub.rs b/protocol/p2p/src/core/hub.rs index 6aa982abf..ad4ca9abf 100644 --- a/protocol/p2p/src/core/hub.rs +++ b/protocol/p2p/src/core/hub.rs @@ -111,9 +111,7 @@ impl Hub { let peers = self.peers.read().values().cloned().collect::>(); // TODO: At least some of the peers should be outbound, because an attacker can gain less control // over the set of outbound peers. - let peers = peers.choose_multiple(&mut rand::thread_rng(), num_peers).cloned().collect::>(); - - for router in peers { + for router in peers.choose_multiple(&mut rand::thread_rng(), num_peers).cloned() { let _ = router.enqueue(msg.clone()).await; } }