Bump clippy, fix warnings (#1939)

* Bumping clippy

* Fixing warnings
This commit is contained in:
Tomasz Drwięga 2016-08-17 16:06:41 +02:00 committed by Gav Wood
parent e2cf8a894f
commit bcf6b0b7d8
22 changed files with 47 additions and 43 deletions

24
Cargo.lock generated
View File

@ -3,7 +3,7 @@ name = "parity"
version = "1.4.0" version = "1.4.0"
dependencies = [ dependencies = [
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)", "ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)",
"daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
@ -133,15 +133,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "clippy" name = "clippy"
version = "0.0.80" version = "0.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"clippy_lints 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "clippy_lints 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "clippy_lints" name = "clippy_lints"
version = "0.0.80" version = "0.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -245,7 +245,7 @@ version = "1.4.0"
dependencies = [ dependencies = [
"bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 1.4.0", "ethash 1.4.0",
@ -274,7 +274,7 @@ dependencies = [
name = "ethcore-dapps" name = "ethcore-dapps"
version = "1.4.0" version = "1.4.0"
dependencies = [ dependencies = [
"clippy 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-rpc 1.4.0", "ethcore-rpc 1.4.0",
"ethcore-util 1.4.0", "ethcore-util 1.4.0",
"hyper 0.9.4 (git+https://github.com/ethcore/hyper)", "hyper 0.9.4 (git+https://github.com/ethcore/hyper)",
@ -408,7 +408,7 @@ dependencies = [
name = "ethcore-rpc" name = "ethcore-rpc"
version = "1.4.0" version = "1.4.0"
dependencies = [ dependencies = [
"clippy 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"ethash 1.4.0", "ethash 1.4.0",
"ethcore 1.4.0", "ethcore 1.4.0",
"ethcore-devtools 1.4.0", "ethcore-devtools 1.4.0",
@ -434,7 +434,7 @@ dependencies = [
name = "ethcore-signer" name = "ethcore-signer"
version = "1.4.0" version = "1.4.0"
dependencies = [ dependencies = [
"clippy 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-io 1.4.0", "ethcore-io 1.4.0",
"ethcore-rpc 1.4.0", "ethcore-rpc 1.4.0",
@ -454,7 +454,7 @@ dependencies = [
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"bigint 0.1.0", "bigint 0.1.0",
"clippy 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"elastic-array 0.4.0 (git+https://github.com/ethcore/elastic-array)", "elastic-array 0.4.0 (git+https://github.com/ethcore/elastic-array)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)", "eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
@ -525,7 +525,7 @@ dependencies = [
name = "ethsync" name = "ethsync"
version = "1.4.0" version = "1.4.0"
dependencies = [ dependencies = [
"clippy 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "clippy 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.4.0", "ethcore 1.4.0",
"ethcore-io 1.4.0", "ethcore-io 1.4.0",
@ -1601,8 +1601,8 @@ dependencies = [
"checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27" "checksum bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c129aff112dcc562970abb69e2508b40850dd24c274761bb50fb8a0067ba6c27"
"checksum bytes 0.4.0-dev (git+https://github.com/carllerche/bytes)" = "<none>" "checksum bytes 0.4.0-dev (git+https://github.com/carllerche/bytes)" = "<none>"
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"
"checksum clippy 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "e96469b413984c78285727f94f9c626a1f2006cecdcf813b5d6893c0c85df42f" "checksum clippy 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "8be61845840f25e9abc06b930d1211c3207f3eb5db92bc001b0510b7e4f361aa"
"checksum clippy_lints 0.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "f11938c4b10c556903bb1c1e717eb038658324bf7197e4cfc159a16417327345" "checksum clippy_lints 0.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "5de435cbb0abacae719e2424a5702afcdf6b51d99b4d52ed5de86094a30e0a80"
"checksum cookie 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90266f45846f14a1e986c77d1e9c2626b8c342ed806fe60241ec38cc8697b245" "checksum cookie 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90266f45846f14a1e986c77d1e9c2626b8c342ed806fe60241ec38cc8697b245"
"checksum crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "fb974f835e90390c5f9dfac00f05b06dc117299f5ea4e85fbc7bb443af4911cc" "checksum crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "fb974f835e90390c5f9dfac00f05b06dc117299f5ea4e85fbc7bb443af4911cc"
"checksum ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)" = "<none>" "checksum ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)" = "<none>"

View File

@ -41,7 +41,7 @@ ethcore-ipc-hypervisor = { path = "ipc/hypervisor" }
ethcore-logger = { path = "logger" } ethcore-logger = { path = "logger" }
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" } json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
ethcore-dapps = { path = "dapps", optional = true } ethcore-dapps = { path = "dapps", optional = true }
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]
winapi = "0.2" winapi = "0.2"

View File

@ -27,7 +27,7 @@ parity-dapps-status = { git = "https://github.com/ethcore/parity-ui.git", versio
parity-dapps-home = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4" } parity-dapps-home = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4" }
parity-dapps-wallet = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4", optional = true } parity-dapps-wallet = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4", optional = true }
mime_guess = { version = "1.6.1" } mime_guess = { version = "1.6.1" }
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
[build-dependencies] [build-dependencies]
serde_codegen = { version = "0.7.0", optional = true } serde_codegen = { version = "0.7.0", optional = true }

View File

@ -12,7 +12,7 @@ syntex = "*"
ethcore-ipc-codegen = { path = "../ipc/codegen" } ethcore-ipc-codegen = { path = "../ipc/codegen" }
[dependencies] [dependencies]
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }
ethcore-ipc = { path = "../ipc/rpc" } ethcore-ipc = { path = "../ipc/rpc" }
rocksdb = { git = "https://github.com/ethcore/rust-rocksdb" } rocksdb = { git = "https://github.com/ethcore/rust-rocksdb" }

View File

@ -25,7 +25,7 @@ semver = "0.2"
bit-set = "0.4" bit-set = "0.4"
time = "0.1" time = "0.1"
evmjit = { path = "../evmjit", optional = true } evmjit = { path = "../evmjit", optional = true }
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
ethash = { path = "../ethash" } ethash = { path = "../ethash" }
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore-io = { path = "../util/io" } ethcore-io = { path = "../util/io" }

View File

@ -117,8 +117,8 @@ impl AddressBook {
pub fn set_name(&mut self, a: Address, name: String) { pub fn set_name(&mut self, a: Address, name: String) {
let mut x = self.cache.get(&a) let mut x = self.cache.get(&a)
.map(|a| a.clone()) .cloned()
.unwrap_or(AccountMeta {name: Default::default(), meta: "{}".to_owned(), uuid: None}); .unwrap_or_else(|| AccountMeta {name: Default::default(), meta: "{}".to_owned(), uuid: None});
x.name = name; x.name = name;
self.cache.insert(a, x); self.cache.insert(a, x);
self.save(); self.save();
@ -126,8 +126,8 @@ impl AddressBook {
pub fn set_meta(&mut self, a: Address, meta: String) { pub fn set_meta(&mut self, a: Address, meta: String) {
let mut x = self.cache.get(&a) let mut x = self.cache.get(&a)
.map(|a| a.clone()) .cloned()
.unwrap_or(AccountMeta {name: "Anonymous".to_owned(), meta: Default::default(), uuid: None}); .unwrap_or_else(|| AccountMeta {name: "Anonymous".to_owned(), meta: Default::default(), uuid: None});
x.meta = meta; x.meta = meta;
self.cache.insert(a, x); self.cache.insert(a, x);
self.save(); self.save();
@ -231,7 +231,7 @@ impl AccountProvider {
pub fn accounts_info(&self) -> Result<HashMap<Address, AccountMeta>, Error> { pub fn accounts_info(&self) -> Result<HashMap<Address, AccountMeta>, Error> {
let r: HashMap<Address, AccountMeta> = try!(self.sstore.accounts()) let r: HashMap<Address, AccountMeta> = try!(self.sstore.accounts())
.into_iter() .into_iter()
.map(|a| (a.clone(), self.account_meta(a).unwrap_or_else(|_| Default::default()))) .map(|a| (a.clone(), self.account_meta(a).ok().unwrap_or_default()))
.collect(); .collect();
Ok(r) Ok(r)
} }

View File

@ -352,11 +352,11 @@ impl<'x> OpenBlock<'x> {
let unclosed_state = s.block.state.clone(); let unclosed_state = s.block.state.clone();
s.engine.on_close_block(&mut s.block); s.engine.on_close_block(&mut s.block);
s.block.base.header.transactions_root = ordered_trie_root(s.block.base.transactions.iter().map(|ref e| e.rlp_bytes().to_vec()).collect()); s.block.base.header.transactions_root = ordered_trie_root(s.block.base.transactions.iter().map(|e| e.rlp_bytes().to_vec()).collect());
let uncle_bytes = s.block.base.uncles.iter().fold(RlpStream::new_list(s.block.base.uncles.len()), |mut s, u| {s.append_raw(&u.rlp(Seal::With), 1); s} ).out(); let uncle_bytes = s.block.base.uncles.iter().fold(RlpStream::new_list(s.block.base.uncles.len()), |mut s, u| {s.append_raw(&u.rlp(Seal::With), 1); s} ).out();
s.block.base.header.uncles_hash = uncle_bytes.sha3(); s.block.base.header.uncles_hash = uncle_bytes.sha3();
s.block.base.header.state_root = s.block.state.root().clone(); s.block.base.header.state_root = s.block.state.root().clone();
s.block.base.header.receipts_root = ordered_trie_root(s.block.receipts.iter().map(|ref r| r.rlp_bytes().to_vec()).collect()); s.block.base.header.receipts_root = ordered_trie_root(s.block.receipts.iter().map(|r| r.rlp_bytes().to_vec()).collect());
s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b = &b | &r.log_bloom; b}); //TODO: use |= operator s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b = &b | &r.log_bloom; b}); //TODO: use |= operator
s.block.base.header.gas_used = s.block.receipts.last().map_or(U256::zero(), |r| r.gas_used); s.block.base.header.gas_used = s.block.receipts.last().map_or(U256::zero(), |r| r.gas_used);
s.block.base.header.note_dirty(); s.block.base.header.note_dirty();
@ -375,14 +375,14 @@ impl<'x> OpenBlock<'x> {
s.engine.on_close_block(&mut s.block); s.engine.on_close_block(&mut s.block);
if s.block.base.header.transactions_root.is_zero() || s.block.base.header.transactions_root == SHA3_NULL_RLP { if s.block.base.header.transactions_root.is_zero() || s.block.base.header.transactions_root == SHA3_NULL_RLP {
s.block.base.header.transactions_root = ordered_trie_root(s.block.base.transactions.iter().map(|ref e| e.rlp_bytes().to_vec()).collect()); s.block.base.header.transactions_root = ordered_trie_root(s.block.base.transactions.iter().map(|e| e.rlp_bytes().to_vec()).collect());
} }
let uncle_bytes = s.block.base.uncles.iter().fold(RlpStream::new_list(s.block.base.uncles.len()), |mut s, u| {s.append_raw(&u.rlp(Seal::With), 1); s} ).out(); let uncle_bytes = s.block.base.uncles.iter().fold(RlpStream::new_list(s.block.base.uncles.len()), |mut s, u| {s.append_raw(&u.rlp(Seal::With), 1); s} ).out();
if s.block.base.header.uncles_hash.is_zero() { if s.block.base.header.uncles_hash.is_zero() {
s.block.base.header.uncles_hash = uncle_bytes.sha3(); s.block.base.header.uncles_hash = uncle_bytes.sha3();
} }
if s.block.base.header.receipts_root.is_zero() || s.block.base.header.receipts_root == SHA3_NULL_RLP { if s.block.base.header.receipts_root.is_zero() || s.block.base.header.receipts_root == SHA3_NULL_RLP {
s.block.base.header.receipts_root = ordered_trie_root(s.block.receipts.iter().map(|ref r| r.rlp_bytes().to_vec()).collect()); s.block.base.header.receipts_root = ordered_trie_root(s.block.receipts.iter().map(|r| r.rlp_bytes().to_vec()).collect());
} }
s.block.base.header.state_root = s.block.state.root().clone(); s.block.base.header.state_root = s.block.state.root().clone();
s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b = &b | &r.log_bloom; b}); //TODO: use |= operator s.block.base.header.log_bloom = s.block.receipts.iter().fold(LogBloom::zero(), |mut b, r| {b = &b | &r.log_bloom; b}); //TODO: use |= operator

View File

@ -28,6 +28,8 @@
#![cfg_attr(feature="dev", allow(clone_on_copy))] #![cfg_attr(feature="dev", allow(clone_on_copy))]
// Complains on Box<E> when implementing From<Box<E>> // Complains on Box<E> when implementing From<Box<E>>
#![cfg_attr(feature="dev", allow(boxed_local))] #![cfg_attr(feature="dev", allow(boxed_local))]
// Complains about nested modules with same name as parent
#![cfg_attr(feature="dev", allow(module_inception))]
// TODO [todr] a lot of warnings to be fixed // TODO [todr] a lot of warnings to be fixed
#![cfg_attr(feature="dev", allow(assign_op_pattern))] #![cfg_attr(feature="dev", allow(assign_op_pattern))]

View File

@ -376,7 +376,7 @@ impl Miner {
(work, is_new) (work, is_new)
}; };
if is_new { if is_new {
work.map(|(pow_hash, difficulty, number)| self.work_poster.as_ref().map(|ref p| p.notify(pow_hash, difficulty, number))); work.map(|(pow_hash, difficulty, number)| self.work_poster.as_ref().map(|p| p.notify(pow_hash, difficulty, number)));
} }
} }

View File

@ -320,7 +320,7 @@ impl State {
} }
fn query_pod(&mut self, query: &PodState) { fn query_pod(&mut self, query: &PodState) {
for (ref address, ref pod_account) in query.get() { for (address, pod_account) in query.get() {
self.ensure_cached(address, true, |a| { self.ensure_cached(address, true, |a| {
if a.is_some() { if a.is_some() {
for key in pod_account.storage.keys() { for key in pod_account.storage.keys() {

View File

@ -10,7 +10,7 @@ rustc-serialize = "0.3"
serde = "0.7.0" serde = "0.7.0"
serde_json = "0.7.0" serde_json = "0.7.0"
serde_macros = { version = "0.7.0", optional = true } serde_macros = { version = "0.7.0", optional = true }
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
[build-dependencies] [build-dependencies]
serde_codegen = { version = "0.7.0", optional = true } serde_codegen = { version = "0.7.0", optional = true }

View File

@ -390,7 +390,7 @@ impl Configuration {
fn extra_data(&self) -> Result<Bytes, String> { fn extra_data(&self) -> Result<Bytes, String> {
match self.args.flag_extradata.as_ref().or(self.args.flag_extra_data.as_ref()) { match self.args.flag_extradata.as_ref().or(self.args.flag_extra_data.as_ref()) {
Some(ref x) if x.len() <= 32 => Ok(x.as_bytes().to_owned()), Some(x) if x.len() <= 32 => Ok(x.as_bytes().to_owned()),
None => Ok(version_data()), None => Ok(version_data()),
Some(_) => Err("Extra data must be at most 32 characters".into()), Some(_) => Err("Extra data must be at most 32 characters".into()),
} }

View File

@ -38,6 +38,6 @@ pub fn execute(cmd: ImportWallet) -> Result<String, String> {
let acc_provider = AccountProvider::new(secret_store); let acc_provider = AccountProvider::new(secret_store);
let wallet = try!(PresaleWallet::open(cmd.wallet_path).map_err(|_| "Unable to open presale wallet.")); let wallet = try!(PresaleWallet::open(cmd.wallet_path).map_err(|_| "Unable to open presale wallet."));
let kp = try!(wallet.decrypt(&password).map_err(|_| "Invalid password.")); let kp = try!(wallet.decrypt(&password).map_err(|_| "Invalid password."));
let address = acc_provider.insert_account(kp.secret().clone(), &password).unwrap(); let address = acc_provider.insert_account(*kp.secret(), &password).unwrap();
Ok(format!("{:?}", address)) Ok(format!("{:?}", address))
} }

View File

@ -25,7 +25,7 @@ ethcore-devtools = { path = "../devtools" }
rustc-serialize = "0.3" rustc-serialize = "0.3"
transient-hashmap = "0.1" transient-hashmap = "0.1"
serde_macros = { version = "0.7.0", optional = true } serde_macros = { version = "0.7.0", optional = true }
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" } json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" }
ethcore-ipc = { path = "../ipc/rpc" } ethcore-ipc = { path = "../ipc/rpc" }

View File

@ -21,7 +21,7 @@ ethcore-io = { path = "../util/io" }
ethcore-rpc = { path = "../rpc" } ethcore-rpc = { path = "../rpc" }
parity-dapps-signer = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4", optional = true} parity-dapps-signer = { git = "https://github.com/ethcore/parity-ui.git", version = "1.4", optional = true}
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
[features] [features]
dev = ["clippy"] dev = ["clippy"]

View File

@ -16,7 +16,7 @@ ethcore-util = { path = "../util" }
ethcore-network = { path = "../util/network" } ethcore-network = { path = "../util/network" }
ethcore-io = { path = "../util/io" } ethcore-io = { path = "../util/io" }
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
log = "0.3" log = "0.3"
env_logger = "0.3" env_logger = "0.3"
time = "0.1.34" time = "0.1.34"

View File

@ -22,7 +22,7 @@ elastic-array = { git = "https://github.com/ethcore/elastic-array" }
heapsize = { version = "0.3", features = ["unstable"] } heapsize = { version = "0.3", features = ["unstable"] }
itertools = "0.4" itertools = "0.4"
sha3 = { path = "sha3" } sha3 = { path = "sha3" }
clippy = { version = "0.0.80", optional = true} clippy = { version = "0.0.82", optional = true}
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }
libc = "0.2.7" libc = "0.2.7"
vergen = "0.1" vergen = "0.1"

View File

@ -218,7 +218,7 @@ impl JournalDB for OverlayRecentDB {
let journal_overlay = self.journal_overlay.read(); let journal_overlay = self.journal_overlay.read();
let key = to_short_key(key); let key = to_short_key(key);
journal_overlay.backing_overlay.get(&key).map(|v| v.to_vec()) journal_overlay.backing_overlay.get(&key).map(|v| v.to_vec())
.or_else(|| journal_overlay.pending_overlay.get(&key).map(|v| v.clone())) .or_else(|| journal_overlay.pending_overlay.get(&key).cloned())
.or_else(|| self.backing.get_by_prefix(self.column, &key[0..DB_PREFIX_LEN]).map(|b| b.to_vec())) .or_else(|| self.backing.get_by_prefix(self.column, &key[0..DB_PREFIX_LEN]).map(|b| b.to_vec()))
} }
@ -365,7 +365,7 @@ impl HashDB for OverlayRecentDB {
let journal_overlay = self.journal_overlay.read(); let journal_overlay = self.journal_overlay.read();
let key = to_short_key(key); let key = to_short_key(key);
journal_overlay.backing_overlay.get(&key).map(|v| v.to_vec()) journal_overlay.backing_overlay.get(&key).map(|v| v.to_vec())
.or_else(|| journal_overlay.pending_overlay.get(&key).map(|v| v.clone())) .or_else(|| journal_overlay.pending_overlay.get(&key).cloned())
}; };
match v { match v {
Some(x) => { Some(x) => {

View File

@ -27,6 +27,8 @@
#![cfg_attr(feature="dev", allow(match_same_arms))] #![cfg_attr(feature="dev", allow(match_same_arms))]
// Keeps consistency (all lines with `.clone()`). // Keeps consistency (all lines with `.clone()`).
#![cfg_attr(feature="dev", allow(clone_on_copy))] #![cfg_attr(feature="dev", allow(clone_on_copy))]
// Some false positives when doing pattern matching.
#![cfg_attr(feature="dev", allow(needless_borrow))]
// TODO [todr] a lot of warnings to be fixed // TODO [todr] a lot of warnings to be fixed
#![cfg_attr(feature="dev", allow(assign_op_pattern))] #![cfg_attr(feature="dev", allow(assign_op_pattern))]

View File

@ -73,7 +73,7 @@ impl<'a> Node<'a> {
stream.append(value); stream.append(value);
stream.out() stream.out()
}, },
Node::Extension(ref slice, ref raw_rlp) => { Node::Extension(ref slice, raw_rlp) => {
let mut stream = RlpStream::new_list(2); let mut stream = RlpStream::new_list(2);
stream.append(&slice.encoded(false)); stream.append(&slice.encoded(false));
stream.append_raw(raw_rlp, 1); stream.append_raw(raw_rlp, 1);
@ -108,7 +108,7 @@ impl<'a> Node<'a> {
stream.append(&slice.encoded(true)); stream.append(&slice.encoded(true));
stream.append(value); stream.append(value);
}, },
Node::Extension(ref slice, ref raw_rlp) => { Node::Extension(ref slice, raw_rlp) => {
stream.begin_list(2); stream.begin_list(2);
stream.append(&slice.encoded(false)); stream.append(&slice.encoded(false));
stream.append_raw(raw_rlp, 1); stream.append_raw(raw_rlp, 1);

View File

@ -153,7 +153,7 @@ impl<'db> TrieDB<'db> {
fn fmt_all(&self, node: Node, f: &mut fmt::Formatter, deepness: usize) -> fmt::Result { fn fmt_all(&self, node: Node, f: &mut fmt::Formatter, deepness: usize) -> fmt::Result {
match node { match node {
Node::Leaf(slice, value) => try!(writeln!(f, "'{:?}: {:?}.", slice, value.pretty())), Node::Leaf(slice, value) => try!(writeln!(f, "'{:?}: {:?}.", slice, value.pretty())),
Node::Extension(ref slice, ref item) => { Node::Extension(ref slice, item) => {
try!(write!(f, "'{:?} ", slice)); try!(write!(f, "'{:?} ", slice));
if let Ok(node) = self.get_node(item) { if let Ok(node) = self.get_node(item) {
try!(self.fmt_all(node, f, deepness)); try!(self.fmt_all(node, f, deepness));
@ -203,8 +203,8 @@ impl<'db> TrieDB<'db> {
where 'db: 'key where 'db: 'key
{ {
match Node::decoded(node) { match Node::decoded(node) {
Node::Leaf(ref slice, ref value) if key == slice => Ok(Some(value)), Node::Leaf(ref slice, value) if key == slice => Ok(Some(value)),
Node::Extension(ref slice, ref item) if key.starts_with(slice) => { Node::Extension(ref slice, item) if key.starts_with(slice) => {
let data = try!(self.get_raw_or_lookup(item)); let data = try!(self.get_raw_or_lookup(item));
self.get_from_node(data, &key.mid(slice.len())) self.get_from_node(data, &key.mid(slice.len()))
}, },

View File

@ -419,8 +419,8 @@ impl<'a> TrieDBMut<'a> {
where 'x: 'key where 'x: 'key
{ {
match RlpNode::decoded(node) { match RlpNode::decoded(node) {
RlpNode::Leaf(ref slice, ref value) if &key == slice => Ok(Some(value)), RlpNode::Leaf(ref slice, value) if &key == slice => Ok(Some(value)),
RlpNode::Extension(ref slice, ref item) if key.starts_with(slice) => { RlpNode::Extension(ref slice, item) if key.starts_with(slice) => {
self.get_from_db_node(try!(self.get_raw_or_lookup(item)), key.mid(slice.len())) self.get_from_db_node(try!(self.get_raw_or_lookup(item)), key.mid(slice.len()))
}, },
RlpNode::Branch(ref nodes, value) => match key.is_empty() { RlpNode::Branch(ref nodes, value) => match key.is_empty() {