Fixing warnings

This commit is contained in:
Tomasz Drwięga 2016-03-13 21:06:24 +01:00
parent 48df41a30a
commit 13df958f4a
2 changed files with 10 additions and 8 deletions

View File

@ -171,7 +171,7 @@ impl EarlyMergeDB {
trace!(target: "jdb.fine", "replay_keys: (end) refs={:?}", refs); trace!(target: "jdb.fine", "replay_keys: (end) refs={:?}", refs);
} }
fn kill_keys(deletes: &Vec<H256>, refs: &mut HashMap<H256, RefInfo>, batch: &DBTransaction, from: RemoveFrom, trace: bool) { fn kill_keys(deletes: &[H256], refs: &mut HashMap<H256, RefInfo>, batch: &DBTransaction, from: RemoveFrom, trace: bool) {
// with a kill on {queue_refs: 1, in_archive: true}, we have two options: // with a kill on {queue_refs: 1, in_archive: true}, we have two options:
// - convert to {queue_refs: 1, in_archive: false} (i.e. remove it from the conceptual archive) // - convert to {queue_refs: 1, in_archive: false} (i.e. remove it from the conceptual archive)
// - convert to {queue_refs: 0, in_archive: true} (i.e. remove it from the conceptual queue) // - convert to {queue_refs: 0, in_archive: true} (i.e. remove it from the conceptual queue)
@ -340,6 +340,8 @@ impl JournalDB for EarlyMergeDB {
} }
} }
#[cfg_attr(feature="dev", allow(cyclomatic_complexity))]
fn commit(&mut self, now: u64, id: &H256, end: Option<(u64, H256)>) -> Result<u32, UtilError> { fn commit(&mut self, now: u64, id: &H256, end: Option<(u64, H256)>) -> Result<u32, UtilError> {
// journal format: // journal format:
// [era, 0] => [ id, [insert_0, ...], [remove_0, ...] ] // [era, 0] => [ id, [insert_0, ...], [remove_0, ...] ]
@ -473,7 +475,7 @@ impl JournalDB for EarlyMergeDB {
if trace { if trace {
trace!(target: "jdb.ops", " Finalising: {:?}", inserts); trace!(target: "jdb.ops", " Finalising: {:?}", inserts);
} }
for k in inserts.iter() { for k in &inserts {
match refs.get(k).cloned() { match refs.get(k).cloned() {
None => { None => {
// [in archive] -> SHIFT remove -> SHIFT insert None->Some{queue_refs: 1, in_archive: true} -> TAKE remove Some{queue_refs: 1, in_archive: true}->None -> TAKE insert // [in archive] -> SHIFT remove -> SHIFT insert None->Some{queue_refs: 1, in_archive: true} -> TAKE remove Some{queue_refs: 1, in_archive: true}->None -> TAKE insert
@ -489,7 +491,7 @@ impl JournalDB for EarlyMergeDB {
Self::set_already_in(&batch, k); Self::set_already_in(&batch, k);
refs.insert(k.clone(), RefInfo{ queue_refs: x - 1, in_archive: true }); refs.insert(k.clone(), RefInfo{ queue_refs: x - 1, in_archive: true });
} }
Some( RefInfo{queue_refs: _, in_archive: true} ) => { Some( RefInfo{in_archive: true, ..} ) => {
// Invalid! Reinserted the same key twice. // Invalid! Reinserted the same key twice.
warn!("Key {} inserted twice into same fork.", k); warn!("Key {} inserted twice into same fork.", k);
} }

View File

@ -363,13 +363,13 @@ impl EncryptedHashMap<H128> for SecretStore {
} }
#[cfg(test)] #[cfg(test)]
#[cfg(feature="heavy-tests")]
mod vector_tests { mod vector_tests {
use super::{derive_mac,derive_key_iterations}; use super::{derive_mac,derive_key_iterations};
use common::*; use common::*;
#[test] #[test]
#[cfg(feature="heavy-tests")]
fn mac_vector() { fn mac_vector() {
let password = "testpassword"; let password = "testpassword";
let salt = H256::from_str("ae3cd4e7013836a3df6bd7241b12db061dbe2c6785853cce422d148a624ce0bd").unwrap(); let salt = H256::from_str("ae3cd4e7013836a3df6bd7241b12db061dbe2c6785853cce422d148a624ce0bd").unwrap();