fixed clippy warnings
This commit is contained in:
parent
26ab437024
commit
5d18a770d4
|
@ -92,17 +92,19 @@ impl OrphanBlocksPool {
|
|||
let parent_orphan_keys: Vec<_> = self.orphaned_blocks.keys().cloned().collect();
|
||||
for parent_orphan_key in parent_orphan_keys {
|
||||
if let Entry::Occupied(mut orphan_entry) = self.orphaned_blocks.entry(parent_orphan_key) {
|
||||
if {
|
||||
let remove_entry = {
|
||||
let mut orphans = orphan_entry.get_mut();
|
||||
let orphans_keys: HashSet<H256> = orphans.keys().cloned().collect();
|
||||
for orphan_to_remove in orphans_keys.intersection(&hashes) {
|
||||
for orphan_to_remove in orphans_keys.intersection(hashes) {
|
||||
self.unknown_blocks.remove(orphan_to_remove);
|
||||
removed.push((orphan_to_remove.clone(),
|
||||
orphans.remove(orphan_to_remove).expect("iterating by intersection of orphans keys with hashes; removing from orphans; qed")
|
||||
));
|
||||
}
|
||||
orphans.is_empty()
|
||||
} {
|
||||
};
|
||||
|
||||
if remove_entry {
|
||||
orphan_entry.remove_entry();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -549,7 +549,7 @@ impl Chain {
|
|||
while let Some(hash) = queue.pop_front() {
|
||||
let all_keys: Vec<_> = self.verifying_transactions.keys().cloned().collect();
|
||||
for h in all_keys {
|
||||
if {
|
||||
let remove_verifying_transaction = {
|
||||
if let Some(entry) = self.verifying_transactions.get(&h) {
|
||||
if entry.inputs.iter().any(|i| i.previous_output.hash == hash) {
|
||||
queue.push_back(h.clone());
|
||||
|
@ -561,7 +561,9 @@ impl Chain {
|
|||
// iterating by previously read keys
|
||||
unreachable!()
|
||||
}
|
||||
} {
|
||||
};
|
||||
|
||||
if remove_verifying_transaction {
|
||||
self.verifying_transactions.remove(&h);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -350,7 +350,7 @@ impl<T> Client for SynchronizationClient<T> where T: TaskExecutor {
|
|||
let unknown_transactions_hashes: Vec<_> = {
|
||||
let chain = self.chain.read();
|
||||
transactions_hashes.into_iter()
|
||||
.filter(|h| chain.transaction_state(&h) == TransactionState::Unknown)
|
||||
.filter(|h| chain.transaction_state(h) == TransactionState::Unknown)
|
||||
.collect()
|
||||
};
|
||||
|
||||
|
@ -557,7 +557,7 @@ impl<T> Client for SynchronizationClient<T> where T: TaskExecutor {
|
|||
let mut chain = self.chain.write();
|
||||
|
||||
// forget for this transaction and all its children
|
||||
chain.forget_verifying_transaction_with_children(&hash);
|
||||
chain.forget_verifying_transaction_with_children(hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -979,7 +979,7 @@ impl<T> SynchronizationClient<T> where T: TaskExecutor {
|
|||
let peer_index = *block_entry.get();
|
||||
// find a # of blocks, which this thread has supplied
|
||||
if let Entry::Occupied(mut entry) = self.verifying_blocks_waiters.entry(peer_index) {
|
||||
if {
|
||||
let is_last_block = {
|
||||
let &mut (ref mut waiting, ref waiter) = entry.get_mut();
|
||||
waiting.remove(hash);
|
||||
// if this is the last block => awake waiting threads
|
||||
|
@ -990,7 +990,9 @@ impl<T> SynchronizationClient<T> where T: TaskExecutor {
|
|||
}
|
||||
}
|
||||
is_last_block
|
||||
} {
|
||||
};
|
||||
|
||||
if is_last_block {
|
||||
entry.remove_entry();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue