Fixing clippy errors in util
This commit is contained in:
@@ -37,6 +37,7 @@ pub struct TrieDB<'db> {
|
||||
pub hash_count: usize,
|
||||
}
|
||||
|
||||
#[allow(wrong_self_convention)]
|
||||
impl<'db> TrieDB<'db> {
|
||||
/// Create a new trie with the backing database `db` and `root`
|
||||
/// Panics, if `root` does not exist
|
||||
@@ -102,7 +103,7 @@ impl<'db> TrieDB<'db> {
|
||||
|
||||
match node {
|
||||
Node::Extension(_, payload) => handle_payload(payload),
|
||||
Node::Branch(payloads, _) => for payload in payloads.iter() { handle_payload(payload) },
|
||||
Node::Branch(payloads, _) => for payload in &payloads { handle_payload(payload) },
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
@@ -140,12 +141,9 @@ impl<'db> TrieDB<'db> {
|
||||
},
|
||||
Node::Branch(ref nodes, ref value) => {
|
||||
try!(writeln!(f, ""));
|
||||
match value {
|
||||
&Some(v) => {
|
||||
try!(self.fmt_indent(f, deepness + 1));
|
||||
try!(writeln!(f, "=: {:?}", v.pretty()))
|
||||
},
|
||||
&None => {}
|
||||
if let Some(v) = *value {
|
||||
try!(self.fmt_indent(f, deepness + 1));
|
||||
try!(writeln!(f, "=: {:?}", v.pretty()))
|
||||
}
|
||||
for i in 0..16 {
|
||||
match self.get_node(nodes[i]) {
|
||||
|
||||
@@ -49,6 +49,7 @@ enum MaybeChanged<'a> {
|
||||
Changed(Bytes),
|
||||
}
|
||||
|
||||
#[allow(wrong_self_convention)]
|
||||
impl<'db> TrieDBMut<'db> {
|
||||
/// Create a new trie with the backing database `db` and empty `root`
|
||||
/// Initialise to the state entailed by the genesis block.
|
||||
@@ -144,7 +145,7 @@ impl<'db> TrieDBMut<'db> {
|
||||
|
||||
match node {
|
||||
Node::Extension(_, payload) => handle_payload(payload),
|
||||
Node::Branch(payloads, _) => for payload in payloads.iter() { handle_payload(payload) },
|
||||
Node::Branch(payloads, _) => for payload in &payloads { handle_payload(payload) },
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
@@ -177,12 +178,9 @@ impl<'db> TrieDBMut<'db> {
|
||||
},
|
||||
Node::Branch(ref nodes, ref value) => {
|
||||
try!(writeln!(f, ""));
|
||||
match value {
|
||||
&Some(v) => {
|
||||
try!(self.fmt_indent(f, deepness + 1));
|
||||
try!(writeln!(f, "=: {:?}", v.pretty()))
|
||||
},
|
||||
&None => {}
|
||||
if let Some(v) = *value {
|
||||
try!(self.fmt_indent(f, deepness + 1));
|
||||
try!(writeln!(f, "=: {:?}", v.pretty()))
|
||||
}
|
||||
for i in 0..16 {
|
||||
match self.get_node(nodes[i]) {
|
||||
@@ -330,6 +328,7 @@ impl<'db> TrieDBMut<'db> {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(cyclomatic_complexity)]
|
||||
/// Determine the RLP of the node, assuming we're inserting `partial` into the
|
||||
/// node currently of data `old`. This will *not* delete any hash of `old` from the database;
|
||||
/// it will just return the new RLP that includes the new node.
|
||||
@@ -704,7 +703,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn unpopulate_trie<'a, 'db>(t: &mut TrieDBMut<'db>, v: &Vec<(Vec<u8>, Vec<u8>)>) {
|
||||
for i in v.iter() {
|
||||
for i in &v {
|
||||
let key: &[u8]= &i.0;
|
||||
t.remove(&key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user