Fixing clippy warnings 2 (#2961)

This commit is contained in:
Tomasz Drwięga 2016-10-29 13:08:49 +02:00 committed by Gav Wood
parent 9e82eeccfe
commit f17cad9dff
6 changed files with 7 additions and 6 deletions

View File

@ -130,7 +130,7 @@ impl BanningTransactionQueue {
// Ban sender // Ban sender
let sender_banned = self.ban_sender(sender); let sender_banned = self.ban_sender(sender);
// Ban recipient and codehash // Ban recipient and codehash
let is_banned = sender_banned || match transaction.action { let recipient_or_code_banned = match transaction.action {
Action::Call(recipient) => { Action::Call(recipient) => {
self.ban_recipient(recipient) self.ban_recipient(recipient)
}, },
@ -138,7 +138,7 @@ impl BanningTransactionQueue {
self.ban_codehash(transaction.data.sha3()) self.ban_codehash(transaction.data.sha3())
}, },
}; };
is_banned sender_banned || recipient_or_code_banned
}, },
None => false, None => false,
} }

View File

@ -110,6 +110,7 @@ impl PartialOrd for TransactionOrigin {
} }
impl Ord for TransactionOrigin { impl Ord for TransactionOrigin {
#[cfg_attr(feature="dev", allow(match_same_arms))]
fn cmp(&self, other: &TransactionOrigin) -> Ordering { fn cmp(&self, other: &TransactionOrigin) -> Ordering {
if *other == *self { if *other == *self {
return Ordering::Equal; return Ordering::Equal;

View File

@ -178,7 +178,7 @@ impl Account {
CodeState::Hash => { CodeState::Hash => {
let code_hash = try!(rlp.val_at(3)); let code_hash = try!(rlp.val_at(3));
if let Some(code) = code_map.get(&code_hash) { if let Some(code) = code_map.get(&code_hash) {
acct_db.emplace(code_hash.clone(), DBValue::from_slice(&code)); acct_db.emplace(code_hash.clone(), DBValue::from_slice(code));
} }
(code_hash, None) (code_hash, None)

View File

@ -184,7 +184,7 @@ impl ChainNotify for Informant {
let ripe = Instant::now() > *last_import + Duration::from_secs(1) && !importing; let ripe = Instant::now() > *last_import + Duration::from_secs(1) && !importing;
let txs_imported = imported.iter() let txs_imported = imported.iter()
.take(imported.len() - if ripe {1} else {0}) .take(imported.len() - if ripe {1} else {0})
.filter_map(|h| self.client.block(BlockID::Hash(h.clone()))) .filter_map(|h| self.client.block(BlockID::Hash(*h)))
.map(|b| BlockView::new(&b).transactions_count()) .map(|b| BlockView::new(&b).transactions_count())
.sum(); .sum();

View File

@ -1509,7 +1509,7 @@ impl ChainSync {
} }
trace!(target: "sync", "{} -> GetNodeData: return {} entries", peer_id, added); trace!(target: "sync", "{} -> GetNodeData: return {} entries", peer_id, added);
let mut rlp = RlpStream::new_list(added); let mut rlp = RlpStream::new_list(added);
for d in data.into_iter() { for d in data {
rlp.append(&d); rlp.append(&d);
} }
Ok(Some((NODE_DATA_PACKET, rlp))) Ok(Some((NODE_DATA_PACKET, rlp)))

View File

@ -133,7 +133,7 @@ impl<'db> TrieDB<'db> {
} }
/// Get the data of the root node. /// Get the data of the root node.
fn root_data<'a, R: 'a + Recorder>(&self, r: &'a mut R) -> super::Result<DBValue> { fn root_data<R: Recorder>(&self, r: &mut R) -> super::Result<DBValue> {
self.db.get(self.root).ok_or_else(|| Box::new(TrieError::InvalidStateRoot(*self.root))) self.db.get(self.root).ok_or_else(|| Box::new(TrieError::InvalidStateRoot(*self.root)))
.map(|node| { r.record(self.root, &*node, 0); node }) .map(|node| { r.record(self.root, &*node, 0); node })
} }