From e2465b1eabca0e55497ccad031f96d7892ffd00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 2 May 2016 13:13:12 +0200 Subject: [PATCH] Bumping clippy & fixing warnings (#1024) * Bumping clippy * Fixing warnings found by clippy --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 2 +- ethcore/Cargo.toml | 2 +- ethcore/src/executive.rs | 2 +- ethcore/src/trace/bloom.rs | 2 +- ethcore/src/trace/db.rs | 1 + ethcore/src/trace/mod.rs | 2 +- json/Cargo.toml | 2 +- miner/Cargo.toml | 2 +- miner/src/miner.rs | 4 ++-- rpc/Cargo.toml | 2 +- sync/Cargo.toml | 2 +- sync/src/chain.rs | 6 +++--- util/Cargo.toml | 2 +- util/src/bytes.rs | 2 +- util/src/keys/directory.rs | 2 +- webapp/Cargo.toml | 2 +- 17 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ef7848baa..3eb540278 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,7 +3,7 @@ name = "parity" version = "1.1.0" dependencies = [ "bincode 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy 0.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 1.1.1 (git+https://github.com/tomusdrw/rust-ctrlc.git)", "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)", @@ -136,7 +136,7 @@ dependencies = [ [[package]] name = "clippy" -version = "0.0.63" +version = "0.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quine-mc_cluskey 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -252,7 +252,7 @@ name = "ethcore" version = "1.1.0" dependencies = [ "bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy 0.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.1.6 (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.1.0", @@ -310,7 +310,7 @@ dependencies = [ name = "ethcore-rpc" version = "1.1.0" dependencies = [ - "clippy 0.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "ethash 1.1.0", "ethcore 1.1.0", "ethcore-util 1.1.0", @@ -334,7 +334,7 @@ dependencies = [ "arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "bigint 0.1.0", "chrono 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy 0.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -366,7 +366,7 @@ dependencies = [ name = "ethcore-webapp" version = "1.1.0" dependencies = [ - "clippy 0.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.64 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-rpc 1.1.0", "ethcore-util 1.1.0", "hyper 0.9.0-mio (git+https://github.com/hyperium/hyper?branch=mio)", @@ -394,7 +394,7 @@ dependencies = [ name = "ethminer" version = "1.1.0" dependencies = [ - "clippy 0.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.64 (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.1.0", "ethcore-util 1.1.0", @@ -408,7 +408,7 @@ dependencies = [ name = "ethsync" version = "1.1.0" dependencies = [ - "clippy 0.0.63 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.64 (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.1.0", "ethcore-util 1.1.0", diff --git a/Cargo.toml b/Cargo.toml index e0d13422b..02e8bb738 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ daemonize = "0.2" num_cpus = "0.2" number_prefix = "0.2" rpassword = "0.2.1" -clippy = { version = "0.0.63", optional = true} +clippy = { version = "0.0.64", optional = true} ethcore = { path = "ethcore" } ethcore-util = { path = "util" } ethsync = { path = "sync" } diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 2fdca148c..ec4c0c302 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -17,7 +17,7 @@ ethcore-util = { path = "../util" } evmjit = { path = "../evmjit", optional = true } ethash = { path = "../ethash" } num_cpus = "0.2" -clippy = { version = "0.0.63", optional = true} +clippy = { version = "0.0.64", optional = true} crossbeam = "0.1.5" lazy_static = "0.1" ethcore-devtools = { path = "../devtools" } diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index fdfc68faf..4247114ef 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -26,7 +26,7 @@ use crossbeam; /// Max depth to avoid stack overflow (when it's reached we start a new thread with VM) /// TODO [todr] We probably need some more sophisticated calculations here (limit on my machine 132) -/// Maybe something like here: https://github.com/ethereum/libethereum/blob/4db169b8504f2b87f7d5a481819cfb959fc65f6c/libethereum/ExtVM.cpp +/// Maybe something like here: `https://github.com/ethereum/libethereum/blob/4db169b8504f2b87f7d5a481819cfb959fc65f6c/libethereum/ExtVM.cpp` const MAX_VM_DEPTH_FOR_THREAD: usize = 64; /// Returns new address created from address and given nonce. diff --git a/ethcore/src/trace/bloom.rs b/ethcore/src/trace/bloom.rs index 6f488c84b..8640240df 100644 --- a/ethcore/src/trace/bloom.rs +++ b/ethcore/src/trace/bloom.rs @@ -87,7 +87,7 @@ impl Encodable for BlockTracesBloomGroup { } } -/// Represents BloomGroup position in database. +/// Represents `BloomGroup` position in database. #[derive(PartialEq, Eq, Hash, Clone, Debug)] pub struct TraceGroupPosition { /// Bloom level. diff --git a/ethcore/src/trace/db.rs b/ethcore/src/trace/db.rs index 0d2468859..5c88ee52b 100644 --- a/ethcore/src/trace/db.rs +++ b/ethcore/src/trace/db.rs @@ -33,6 +33,7 @@ use super::flat::{FlatTrace, FlatBlockTraces, FlatTransactionTraces}; const TRACE_DB_VER: &'static [u8] = b"1.0"; #[derive(Debug, Copy, Clone)] +#[cfg_attr(feature="dev", allow(enum_variant_names))] enum TraceDBIndex { /// Block traces index. BlockTraces = 0, diff --git a/ethcore/src/trace/mod.rs b/ethcore/src/trace/mod.rs index 445689310..831a55cd5 100644 --- a/ethcore/src/trace/mod.rs +++ b/ethcore/src/trace/mod.rs @@ -88,7 +88,7 @@ pub trait Tracer: Send { fn traces(self) -> Vec; } -/// DbExtras provides an interface to query extra data which is not stored in tracesdb, +/// `DbExtras` provides an interface to query extra data which is not stored in tracesdb, /// but necessary to work correctly. pub trait DatabaseExtras { /// Returns hash of given block number. diff --git a/json/Cargo.toml b/json/Cargo.toml index ce15894e4..48014189b 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -10,7 +10,7 @@ rustc-serialize = "0.3" serde = "0.7.0" serde_json = "0.7.0" serde_macros = { version = "0.7.0", optional = true } -clippy = { version = "0.0.63", optional = true} +clippy = { version = "0.0.64", optional = true} [build-dependencies] serde_codegen = { version = "0.7.0", optional = true } diff --git a/miner/Cargo.toml b/miner/Cargo.toml index f5ecb94a9..54d1453cc 100644 --- a/miner/Cargo.toml +++ b/miner/Cargo.toml @@ -17,7 +17,7 @@ log = "0.3" env_logger = "0.3" rustc-serialize = "0.3" rayon = "0.3.1" -clippy = { version = "0.0.63", optional = true} +clippy = { version = "0.0.64", optional = true} [features] default = [] diff --git a/miner/src/miner.rs b/miner/src/miner.rs index daf62c107..b9de28e42 100644 --- a/miner/src/miner.rs +++ b/miner/src/miner.rs @@ -205,9 +205,9 @@ impl MinerService for Miner { let last_hashes = chain.last_hashes(); let env_info = EnvInfo { number: header.number(), - author: header.author().clone(), + author: *header.author(), timestamp: header.timestamp(), - difficulty: header.difficulty().clone(), + difficulty: *header.difficulty(), last_hashes: last_hashes, gas_used: U256::zero(), gas_limit: U256::max_value(), diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 817e2b3b7..e384e3dca 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -22,7 +22,7 @@ ethminer = { path = "../miner" } rustc-serialize = "0.3" transient-hashmap = "0.1" serde_macros = { version = "0.7.0", optional = true } -clippy = { version = "0.0.63", optional = true} +clippy = { version = "0.0.64", optional = true} [build-dependencies] serde_codegen = { version = "0.7.0", optional = true } diff --git a/sync/Cargo.toml b/sync/Cargo.toml index e6f17557b..6c4b1d90c 100644 --- a/sync/Cargo.toml +++ b/sync/Cargo.toml @@ -10,7 +10,7 @@ authors = ["Ethcore Result<(), PacketDecodeError> { if self.peers.get_mut(&peer_id).unwrap().asking != PeerAsking::Nothing { trace!(target: "sync", "Ignoring new hashes since we're already downloading."); diff --git a/util/Cargo.toml b/util/Cargo.toml index 853889563..a0c883513 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -27,7 +27,7 @@ crossbeam = "0.2" slab = "0.1" sha3 = { path = "sha3" } serde = "0.7.0" -clippy = { version = "0.0.63", optional = true} +clippy = { version = "0.0.64", optional = true} json-tests = { path = "json-tests" } igd = "0.4.2" ethcore-devtools = { path = "../devtools" } diff --git a/util/src/bytes.rs b/util/src/bytes.rs index 7a7474668..5ef2044ee 100644 --- a/util/src/bytes.rs +++ b/util/src/bytes.rs @@ -425,7 +425,7 @@ impl<'a, V1, V2, T3> ToBytesWithMap for (&'a Vec, &'a Vec, &'a T3) impl FromRawBytesVariable for Vec { fn from_bytes_variable(bytes: &[u8]) -> Result, FromBytesError> { - Ok(bytes.clone().to_vec()) + Ok(bytes.to_vec()) } } diff --git a/util/src/keys/directory.rs b/util/src/keys/directory.rs index cc9ea37af..d9268a95f 100644 --- a/util/src/keys/directory.rs +++ b/util/src/keys/directory.rs @@ -326,7 +326,7 @@ fn uuid_from_string(s: &str) -> Result { #[derive(Clone)] -/// Stored key file struct with encrypted message (`cipher_text`) +/// Stored key file struct with encrypted message `(cipher_text)` /// also contains password derivation function settings (PBKDF2/Scrypt) pub struct KeyFileContent { version: KeyFileVersion, diff --git a/webapp/Cargo.toml b/webapp/Cargo.toml index d2d5108f9..673bae1d7 100644 --- a/webapp/Cargo.toml +++ b/webapp/Cargo.toml @@ -19,7 +19,7 @@ parity-webapp = { git = "https://github.com/tomusdrw/parity-webapp.git" } # List of apps parity-status = { git = "https://github.com/tomusdrw/parity-status.git", version = "0.3.3" } parity-wallet = { git = "https://github.com/tomusdrw/parity-wallet.git", optional = true } -clippy = { version = "0.0.63", optional = true} +clippy = { version = "0.0.64", optional = true} [features] default = []