diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 8e2b9e9f5..e60996099 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -459,7 +459,7 @@ impl ChainSync { /// Updates transactions were received by a peer pub fn transactions_received(&mut self, hashes: Vec, peer_id: PeerId) { - if let Some(mut peer_info) = self.peers.get_mut(&peer_id) { + if let Some(peer_info) = self.peers.get_mut(&peer_id) { peer_info.last_sent_transactions.extend(&hashes); } } @@ -730,7 +730,7 @@ impl ChainSync { } let result = { - let mut downloader = match block_set { + let downloader = match block_set { BlockSet::NewBlocks => &mut self.new_blocks, BlockSet::OldBlocks => { match self.old_blocks { @@ -795,7 +795,7 @@ impl ChainSync { else { let result = { - let mut downloader = match block_set { + let downloader = match block_set { BlockSet::NewBlocks => &mut self.new_blocks, BlockSet::OldBlocks => match self.old_blocks { None => { @@ -849,7 +849,7 @@ impl ChainSync { else { let result = { - let mut downloader = match block_set { + let downloader = match block_set { BlockSet::NewBlocks => &mut self.new_blocks, BlockSet::OldBlocks => match self.old_blocks { None => { @@ -2186,7 +2186,7 @@ impl ChainSync { // Select random peer to re-broadcast transactions to. let peer = random::new().gen_range(0, self.peers.len()); trace!(target: "sync", "Re-broadcasting transactions to a random peer."); - self.peers.values_mut().nth(peer).map(|mut peer_info| + self.peers.values_mut().nth(peer).map(|peer_info| peer_info.last_sent_transactions.clear() ); } diff --git a/sync/src/transactions_stats.rs b/sync/src/transactions_stats.rs index 7a1257cba..aa4aa136e 100644 --- a/sync/src/transactions_stats.rs +++ b/sync/src/transactions_stats.rs @@ -57,8 +57,8 @@ impl TransactionsStats { /// Increases number of propagations to given `enodeid`. pub fn propagated(&mut self, hash: &H256, enode_id: Option, current_block_num: BlockNumber) { let enode_id = enode_id.unwrap_or_default(); - let mut stats = self.pending_transactions.entry(*hash).or_insert_with(|| Stats::new(current_block_num)); - let mut count = stats.propagated_to.entry(enode_id).or_insert(0); + let stats = self.pending_transactions.entry(*hash).or_insert_with(|| Stats::new(current_block_num)); + let count = stats.propagated_to.entry(enode_id).or_insert(0); *count = count.saturating_add(1); }