Fixing all clippy lints
This commit is contained in:
@@ -191,6 +191,7 @@ impl<K, V> RangeCollection<K, V> for Vec<(K, Vec<V>)> where K: Ord + PartialEq +
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[allow(cyclomatic_complexity)]
|
||||
fn test_range() {
|
||||
use std::cmp::{Ordering};
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
}
|
||||
|
||||
fn block(&self, h: &H256) -> Option<Bytes> {
|
||||
self.blocks.get(h).map(|b| b.clone())
|
||||
self.blocks.get(h).cloned()
|
||||
}
|
||||
|
||||
fn block_status(&self, h: &H256) -> BlockStatus {
|
||||
@@ -208,7 +208,7 @@ impl<'p> SyncIo for TestIo<'p> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn chain<'a>(&'a mut self) -> &'a mut BlockChainClient {
|
||||
fn chain(&mut self) -> &mut BlockChainClient {
|
||||
self.chain
|
||||
}
|
||||
}
|
||||
@@ -265,14 +265,11 @@ impl TestNet {
|
||||
|
||||
pub fn sync_step(&mut self) {
|
||||
for peer in 0..self.peers.len() {
|
||||
match self.peers[peer].queue.pop_front() {
|
||||
Some(packet) => {
|
||||
let mut p = self.peers.get_mut(packet.recipient).unwrap();
|
||||
trace!("--- {} -> {} ---", peer, packet.recipient);
|
||||
p.sync.on_packet(&mut TestIo::new(&mut p.chain, &mut p.queue, Some(peer as PeerId)), peer as PeerId, packet.packet_id, &packet.data);
|
||||
trace!("----------------");
|
||||
},
|
||||
None => {}
|
||||
if let Some(packet) = self.peers[peer].queue.pop_front() {
|
||||
let mut p = self.peers.get_mut(packet.recipient).unwrap();
|
||||
trace!("--- {} -> {} ---", peer, packet.recipient);
|
||||
p.sync.on_packet(&mut TestIo::new(&mut p.chain, &mut p.queue, Some(peer as PeerId)), peer as PeerId, packet.packet_id, &packet.data);
|
||||
trace!("----------------");
|
||||
}
|
||||
let mut p = self.peers.get_mut(peer).unwrap();
|
||||
p.sync.maintain_sync(&mut TestIo::new(&mut p.chain, &mut p.queue, None));
|
||||
|
||||
Reference in New Issue
Block a user