From e1e7886918fec35982714c1b1c20c618bb1d8dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 28 Nov 2016 12:20:57 +0100 Subject: [PATCH 1/4] Bumping clippy --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 2 +- dapps/Cargo.toml | 2 +- db/Cargo.toml | 2 +- ethcore/Cargo.toml | 2 +- json/Cargo.toml | 2 +- rpc/Cargo.toml | 2 +- signer/Cargo.toml | 2 +- sync/Cargo.toml | 2 +- util/Cargo.toml | 2 +- util/network/Cargo.toml | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62ef5ea11..0d98ecd10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,7 +3,7 @@ name = "parity" version = "1.5.0" dependencies = [ "ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)", @@ -146,15 +146,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "clippy" -version = "0.0.96" +version = "0.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "clippy_lints 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy_lints 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clippy_lints" -version = "0.0.96" +version = "0.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -280,7 +280,7 @@ dependencies = [ "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)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.103 (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)", "ethash 1.4.0", @@ -333,7 +333,7 @@ dependencies = [ name = "ethcore-dapps" version = "1.5.0" dependencies = [ - "clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-devtools 1.4.0", "ethcore-hash-fetch 1.5.0", @@ -490,7 +490,7 @@ dependencies = [ name = "ethcore-rpc" version = "1.5.0" dependencies = [ - "clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "ethash 1.4.0", "ethcore 1.5.0", "ethcore-devtools 1.4.0", @@ -520,7 +520,7 @@ dependencies = [ name = "ethcore-signer" version = "1.5.0" dependencies = [ - "clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "ethcore-devtools 1.4.0", "ethcore-io 1.5.0", @@ -559,7 +559,7 @@ version = "1.5.0" dependencies = [ "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)", - "clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)", "elastic-array 0.6.0 (git+https://github.com/ethcore/elastic-array)", "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)", @@ -649,7 +649,7 @@ dependencies = [ name = "ethsync" version = "1.5.0" dependencies = [ - "clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy 0.0.103 (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.5.0", "ethcore-io 1.5.0", @@ -2005,8 +2005,8 @@ dependencies = [ "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)" = "" "checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c" -"checksum clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)" = "6eacf01b0aad84a0817703498f72d252df7c0faf6a5b86d0be4265f1829e459f" -"checksum clippy_lints 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)" = "a49960c9aab544ce86b004dcb61620e8b898fea5fc0f697a028f460f48221ed6" +"checksum clippy 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "5b4fabf979ddf6419a313c1c0ada4a5b95cfd2049c56e8418d622d27b4b6ff32" +"checksum clippy_lints 0.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "ce96ec05bfe018a0d5d43da115e54850ea2217981ff0f2e462780ab9d594651a" "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 ctrlc 1.1.1 (git+https://github.com/ethcore/rust-ctrlc.git)" = "" diff --git a/Cargo.toml b/Cargo.toml index a8d7ba794..3808cce95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ ethcore-hash-fetch = { path = "ethcore/hash-fetch" } rlp = { path = "util/rlp" } ethcore-stratum = { path = "stratum" } ethcore-dapps = { path = "dapps", optional = true } -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} [target.'cfg(windows)'.dependencies] winapi = "0.2" diff --git a/dapps/Cargo.toml b/dapps/Cargo.toml index 15e537820..6be30884a 100644 --- a/dapps/Cargo.toml +++ b/dapps/Cargo.toml @@ -34,7 +34,7 @@ ethcore-hash-fetch = { path = "../ethcore/hash-fetch" } fetch = { path = "../util/fetch" } parity-ui = { path = "./ui" } -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} [build-dependencies] serde_codegen = { version = "0.8", optional = true } diff --git a/db/Cargo.toml b/db/Cargo.toml index 27eadef4a..2b4a19892 100644 --- a/db/Cargo.toml +++ b/db/Cargo.toml @@ -11,7 +11,7 @@ build = "build.rs" ethcore-ipc-codegen = { path = "../ipc/codegen" } [dependencies] -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} ethcore-devtools = { path = "../devtools" } ethcore-ipc = { path = "../ipc/rpc" } rocksdb = { git = "https://github.com/ethcore/rust-rocksdb" } diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 48fce064a..bd87c422f 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -29,7 +29,7 @@ byteorder = "0.5" transient-hashmap = "0.1" linked-hash-map = "0.3.0" evmjit = { path = "../evmjit", optional = true } -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} ethash = { path = "../ethash" } ethcore-util = { path = "../util" } ethcore-io = { path = "../util/io" } diff --git a/json/Cargo.toml b/json/Cargo.toml index 8f7b0c227..67303cc7e 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -10,7 +10,7 @@ rustc-serialize = "0.3" serde = "0.8" serde_json = "0.8" serde_macros = { version = "0.8", optional = true } -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} [build-dependencies] serde_codegen = { version = "0.8", optional = true } diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 4a8c4d76a..8598372f8 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -29,7 +29,7 @@ fetch = { path = "../util/fetch" } rustc-serialize = "0.3" transient-hashmap = "0.1" serde_macros = { version = "0.8.0", optional = true } -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} json-ipc-server = { git = "https://github.com/ethcore/json-ipc-server.git" } ethcore-ipc = { path = "../ipc/rpc" } time = "0.1" diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 2a3742ec8..4b56ec474 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -23,7 +23,7 @@ ethcore-rpc = { path = "../rpc" } ethcore-devtools = { path = "../devtools" } parity-ui = { path = "../dapps/ui", version = "1.4", optional = true } -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} [features] dev = ["clippy"] diff --git a/sync/Cargo.toml b/sync/Cargo.toml index c7e30d6a5..738f5f55c 100644 --- a/sync/Cargo.toml +++ b/sync/Cargo.toml @@ -17,7 +17,7 @@ ethcore-network = { path = "../util/network" } ethcore-io = { path = "../util/io" } ethcore = { path = "../ethcore" } rlp = { path = "../util/rlp" } -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} log = "0.3" env_logger = "0.3" time = "0.1.34" diff --git a/util/Cargo.toml b/util/Cargo.toml index cc342eeca..1a439ebf8 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -23,7 +23,7 @@ rlp = { path = "rlp" } heapsize = { version = "0.3", features = ["unstable"] } itertools = "0.4" sha3 = { path = "sha3" } -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} ethcore-devtools = { path = "../devtools" } libc = "0.2.7" vergen = "0.1" diff --git a/util/network/Cargo.toml b/util/network/Cargo.toml index fe1938305..37ff825b0 100644 --- a/util/network/Cargo.toml +++ b/util/network/Cargo.toml @@ -15,7 +15,7 @@ time = "0.1.34" tiny-keccak = "1.0" rust-crypto = "0.2.34" slab = "0.2" -clippy = { version = "0.0.96", optional = true} +clippy = { version = "0.0.103", optional = true} igd = "0.5.0" libc = "0.2.7" parking_lot = "0.3" From 2b3d100de22f8b4016860d617d36aaa78b2b2bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 28 Nov 2016 13:20:49 +0100 Subject: [PATCH 2/4] Fixing some clippy warnings --- ethcore/src/client/client.rs | 4 ++-- ethcore/src/engines/authority_round.rs | 6 +++--- ethcore/src/evm/interpreter/gasometer.rs | 20 +++++++++----------- ethcore/src/evm/tests.rs | 4 ++-- ethcore/src/executive.rs | 3 +-- ethcore/src/miner/miner.rs | 8 ++++---- ethcore/src/miner/transaction_queue.rs | 3 +-- ethcore/src/snapshot/mod.rs | 6 +++--- ethcore/src/state/account.rs | 1 - ethcore/src/state/mod.rs | 1 + ethcore/src/state/substate.rs | 1 + ethcore/src/state_db.rs | 1 + ethcore/src/tests/client.rs | 12 ++++++------ ethcore/src/tests/helpers.rs | 2 +- ethcore/src/types/mode.rs | 12 ++++++------ ethcore/src/types/transaction.rs | 10 +++++----- parity/run.rs | 2 +- rpc/src/v1/types/filter.rs | 2 +- signer/src/authcode_store.rs | 3 ++- signer/src/ws_server/session.rs | 2 +- sync/src/chain.rs | 8 +++----- sync/src/tests/helpers.rs | 12 ++++++------ util/network/src/connection.rs | 1 - util/network/src/discovery.rs | 4 ---- util/network/src/handshake.rs | 1 - util/network/src/node_table.rs | 2 -- util/src/common.rs | 7 +++++++ util/src/journaldb/archivedb.rs | 1 - util/src/journaldb/earlymergedb.rs | 1 - util/src/journaldb/overlayrecentdb.rs | 1 - util/src/journaldb/refcounteddb.rs | 1 - util/src/kvdb.rs | 1 - util/src/stats.rs | 10 +++++----- 33 files changed, 72 insertions(+), 81 deletions(-) diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 0e0b292f9..2ac6c98e3 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -869,8 +869,8 @@ impl BlockChainClient for Client { } fn keep_alive(&self) { - let should_wake = match &*self.mode.lock() { - &Mode::Dark(..) | &Mode::Passive(..) => true, + let should_wake = match *self.mode.lock() { + Mode::Dark(..) | Mode::Passive(..) => true, _ => false, }; if should_wake { diff --git a/ethcore/src/engines/authority_round.rs b/ethcore/src/engines/authority_round.rs index 830fcf9c8..be7d9a0fd 100644 --- a/ethcore/src/engines/authority_round.rs +++ b/ethcore/src/engines/authority_round.rs @@ -124,7 +124,7 @@ impl AuthorityRound { } fn step_proposer(&self, step: usize) -> &Address { - let ref p = self.our_params; + let p = &self.our_params; p.authorities.get(step % p.authority_n).expect("There are authority_n authorities; taking number modulo authority_n gives number in authority_n range; qed") } @@ -211,7 +211,7 @@ impl Engine for AuthorityRound { fn on_close_block(&self, _block: &mut ExecutedBlock) {} fn is_sealer(&self, author: &Address) -> Option { - let ref p = self.our_params; + let p = &self.our_params; Some(p.authorities.contains(author)) } @@ -279,7 +279,7 @@ impl Engine for AuthorityRound { let step = try!(header_step(header)); // Check if parent is from a previous step. - if step == try!(header_step(parent)) { + if step == try!(header_step(parent)) { trace!(target: "poa", "Multiple blocks proposed for step {}.", step); try!(Err(BlockError::DoubleVote(header.author().clone()))); } diff --git a/ethcore/src/evm/interpreter/gasometer.rs b/ethcore/src/evm/interpreter/gasometer.rs index beaaadac5..886120880 100644 --- a/ethcore/src/evm/interpreter/gasometer.rs +++ b/ethcore/src/evm/interpreter/gasometer.rs @@ -197,19 +197,17 @@ impl Gasometer { let address = u256_to_address(stack.peek(1)); let is_value_transfer = !stack.peek(2).is_zero(); - if instruction == instructions::CALL { - if ( - !schedule.no_empty && !ext.exists(&address) - ) || ( - schedule.no_empty && is_value_transfer && !ext.exists_and_not_null(&address) - ) { - gas = overflowing!(gas.overflow_add(schedule.call_new_account_gas.into())); - } - }; + if instruction == instructions::CALL && ( + (!schedule.no_empty && !ext.exists(&address)) + || + (schedule.no_empty && is_value_transfer && !ext.exists_and_not_null(&address)) + ) { + gas = overflowing!(gas.overflow_add(schedule.call_new_account_gas.into())); + } if is_value_transfer { gas = overflowing!(gas.overflow_add(schedule.call_value_transfer_gas.into())); - }; + } let requested = *stack.peek(0); @@ -347,7 +345,7 @@ fn test_mem_gas_cost() { let result = gasometer.mem_gas_cost(&schedule, current_mem_size, &mem_size); // then - if let Ok(_) = result { + if result.is_ok() { assert!(false, "Should fail with OutOfGas"); } } diff --git a/ethcore/src/evm/tests.rs b/ethcore/src/evm/tests.rs index 7e69c0771..6cfc9a43e 100644 --- a/ethcore/src/evm/tests.rs +++ b/ethcore/src/evm/tests.rs @@ -95,7 +95,7 @@ impl Ext for FakeExt { } fn exists_and_not_null(&self, address: &Address) -> bool { - self.balances.get(address).map_or(false, |b| !b.is_zero()) + self.balances.get(address).map_or(false, |b| !b.is_zero()) } fn origin_balance(&self) -> U256 { @@ -103,7 +103,7 @@ impl Ext for FakeExt { } fn balance(&self, address: &Address) -> U256 { - *self.balances.get(address).unwrap() + self.balances[address] } fn blockhash(&self, number: &U256) -> H256 { diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index 5da105e2f..f9178f766 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -445,7 +445,7 @@ impl<'a> Executive<'a> { trace!("exec::finalize: Refunding refund_value={}, sender={}\n", refund_value, sender); // Below: NoEmpty is safe since the sender must already be non-null to have sent this transaction - self.state.add_balance(&sender, &refund_value, CleanupMode::NoEmpty); + self.state.add_balance(&sender, &refund_value, CleanupMode::NoEmpty); trace!("exec::finalize: Compensating author: fees_value={}, author={}\n", fees_value, &self.info.author); self.state.add_balance(&self.info.author, &fees_value, substate.to_cleanup_mode(&schedule)); @@ -516,7 +516,6 @@ impl<'a> Executive<'a> { mod tests { use ethkey::{Generator, Random}; use super::*; - use util::*; use action_params::{ActionParams, ActionValue}; use env_info::EnvInfo; use evm::{Factory, VMType}; diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index 9d4e66918..ef8508749 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -151,7 +151,7 @@ impl GasPriceCalibrator { if Instant::now() >= self.next_calibration { let usd_per_tx = self.options.usd_per_tx; trace!(target: "miner", "Getting price info"); - if let Ok(_) = PriceInfo::get(move |price: PriceInfo| { + let price_info = PriceInfo::get(move |price: PriceInfo| { trace!(target: "miner", "Price info arrived: {:?}", price); let usd_per_eth = price.ethusd; let wei_per_usd: f32 = 1.0e18 / usd_per_eth; @@ -159,7 +159,9 @@ impl GasPriceCalibrator { let wei_per_gas: f32 = wei_per_usd * usd_per_tx / gas_per_tx; info!(target: "miner", "Updated conversion rate to Ξ1 = {} ({} wei/gas)", Colour::White.bold().paint(format!("US${}", usd_per_eth)), Colour::Yellow.bold().paint(format!("{}", wei_per_gas))); set_price(U256::from(wei_per_gas as u64)); - }) { + }); + + if price_info.is_ok() { self.next_calibration = Instant::now() + self.options.recalibration_period; } else { warn!(target: "miner", "Unable to update Ether price."); @@ -1142,12 +1144,10 @@ mod tests { use std::time::Duration; use super::super::{MinerService, PrioritizationStrategy}; use super::*; - use util::*; use ethkey::{Generator, Random}; use client::{BlockChainClient, TestBlockChainClient, EachBlockWith, TransactionImportResult}; use header::BlockNumber; use types::transaction::{Transaction, SignedTransaction, Action}; - use block::*; use spec::Spec; use tests::helpers::{generate_dummy_client}; diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs index bfbd3fade..b8dadee9e 100644 --- a/ethcore/src/miner/transaction_queue.rs +++ b/ethcore/src/miner/transaction_queue.rs @@ -990,7 +990,7 @@ impl TransactionQueue { let mut update_last_nonce_to = None; { let by_nonce = self.future.by_address.row_mut(&address); - if let None = by_nonce { + if by_nonce.is_none() { return; } let mut by_nonce = by_nonce.expect("None is tested in early-exit condition above; qed"); @@ -1212,7 +1212,6 @@ mod test { use util::table::*; use util::*; use ethkey::{Random, Generator}; - use transaction::*; use error::{Error, TransactionError}; use super::*; use super::{TransactionSet, TransactionOrder, VerifiedTransaction}; diff --git a/ethcore/src/snapshot/mod.rs b/ethcore/src/snapshot/mod.rs index 3f63ac208..408941309 100644 --- a/ethcore/src/snapshot/mod.rs +++ b/ethcore/src/snapshot/mod.rs @@ -552,11 +552,11 @@ const POW_VERIFY_RATE: f32 = 0.02; pub fn verify_old_block(rng: &mut OsRng, header: &Header, engine: &Engine, chain: &BlockChain, body: Option<&[u8]>, always: bool) -> Result<(), ::error::Error> { if always || rng.gen::() <= POW_VERIFY_RATE { match chain.block_header(header.parent_hash()) { - Some(parent) => engine.verify_block_family(&header, &parent, body), - None => engine.verify_block_seal(&header), + Some(parent) => engine.verify_block_family(header, &parent, body), + None => engine.verify_block_seal(header), } } else { - engine.verify_block_basic(&header, body) + engine.verify_block_basic(header, body) } } diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index 76061f6a0..584ab0936 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -449,7 +449,6 @@ mod tests { use util::*; use super::*; use account_db::*; - use rlp::*; #[test] fn account_compress() { diff --git a/ethcore/src/state/mod.rs b/ethcore/src/state/mod.rs index 01a7e3b15..d41018cde 100644 --- a/ethcore/src/state/mod.rs +++ b/ethcore/src/state/mod.rs @@ -445,6 +445,7 @@ impl State { } /// Add `incr` to the balance of account `a`. + #[cfg_attr(feature="dev", allow(single_match))] pub fn add_balance(&mut self, a: &Address, incr: &U256, cleanup_mode: CleanupMode) { trace!(target: "state", "add_balance({}, {}): {}", a, incr, self.balance(a)); let is_value_transfer = !incr.is_zero(); diff --git a/ethcore/src/state/substate.rs b/ethcore/src/state/substate.rs index 853b0e422..c11f802a1 100644 --- a/ethcore/src/state/substate.rs +++ b/ethcore/src/state/substate.rs @@ -57,6 +57,7 @@ impl Substate { } /// Get the cleanup mode object from this. + #[cfg_attr(feature="dev", allow(wrong_self_convention))] pub fn to_cleanup_mode(&mut self, schedule: &Schedule) -> CleanupMode { match (schedule.no_empty, schedule.kill_empty) { (false, _) => CleanupMode::ForceCreate, diff --git a/ethcore/src/state_db.rs b/ethcore/src/state_db.rs index 3a3595a35..eafa4022e 100644 --- a/ethcore/src/state_db.rs +++ b/ethcore/src/state_db.rs @@ -397,6 +397,7 @@ impl StateDB { } /// Get cached code based on hash. + #[cfg_attr(feature="dev", allow(map_clone))] pub fn get_cached_code(&self, hash: &H256) -> Option>> { let mut cache = self.code_cache.lock(); diff --git a/ethcore/src/tests/client.rs b/ethcore/src/tests/client.rs index 99b251d66..427082823 100644 --- a/ethcore/src/tests/client.rs +++ b/ethcore/src/tests/client.rs @@ -62,7 +62,7 @@ fn should_return_registrar() { &db_config ).unwrap(); let params = client.additional_params(); - let address = params.get("registrar").unwrap(); + let address = ¶ms["registrar"]; assert_eq!(address.len(), 40); assert!(U256::from_str(address).is_ok()); @@ -93,7 +93,7 @@ fn imports_good_block() { &db_config ).unwrap(); let good_block = get_good_dummy_block(); - if let Err(_) = client.import_block(good_block) { + if client.import_block(good_block).is_err() { panic!("error importing block being good by definition"); } client.flush_queue(); @@ -203,18 +203,18 @@ fn can_collect_garbage() { #[test] fn can_generate_gas_price_median() { - let client_result = generate_dummy_client_with_data(3, 1, &vec_into![1, 2, 3]); + let client_result = generate_dummy_client_with_data(3, 1, slice_into![1, 2, 3]); let client = client_result.reference(); assert_eq!(Some(U256::from(2)), client.gas_price_median(3)); - let client_result = generate_dummy_client_with_data(4, 1, &vec_into![1, 4, 3, 2]); + let client_result = generate_dummy_client_with_data(4, 1, slice_into![1, 4, 3, 2]); let client = client_result.reference(); assert_eq!(Some(U256::from(3)), client.gas_price_median(4)); } #[test] fn can_generate_gas_price_histogram() { - let client_result = generate_dummy_client_with_data(20, 1, &vec_into![6354,8593,6065,4842,7845,7002,689,4958,4250,6098,5804,4320,643,8895,2296,8589,7145,2000,2512,1408]); + let client_result = generate_dummy_client_with_data(20, 1, slice_into![6354,8593,6065,4842,7845,7002,689,4958,4250,6098,5804,4320,643,8895,2296,8589,7145,2000,2512,1408]); let client = client_result.reference(); let hist = client.gas_price_histogram(20, 5).unwrap(); @@ -224,7 +224,7 @@ fn can_generate_gas_price_histogram() { #[test] fn empty_gas_price_histogram() { - let client_result = generate_dummy_client_with_data(20, 0, &vec_into![]); + let client_result = generate_dummy_client_with_data(20, 0, slice_into![]); let client = client_result.reference(); assert!(client.gas_price_histogram(20, 5).is_none()); diff --git a/ethcore/src/tests/helpers.rs b/ethcore/src/tests/helpers.rs index adfb4f096..5a159edd9 100644 --- a/ethcore/src/tests/helpers.rs +++ b/ethcore/src/tests/helpers.rs @@ -262,7 +262,7 @@ pub fn get_test_client_with_blocks(blocks: Vec) -> GuardedTempResult for ClientMode { Mode::Active => ClientMode::Active, } } -} \ No newline at end of file +} diff --git a/ethcore/src/types/transaction.rs b/ethcore/src/types/transaction.rs index 8289c5864..7dba4da53 100644 --- a/ethcore/src/types/transaction.rs +++ b/ethcore/src/types/transaction.rs @@ -73,7 +73,7 @@ pub struct Transaction { impl Transaction { /// Append object with a without signature into RLP stream pub fn rlp_append_unsigned_transaction(&self, s: &mut RlpStream, network_id: Option) { - s.begin_list(if let None = network_id { 6 } else { 9 }); + s.begin_list(if network_id.is_none() { 6 } else { 9 }); s.append(&self.nonce); s.append(&self.gas_price); s.append(&self.gas); @@ -210,7 +210,7 @@ pub struct SignedTransaction { /// Plain Transaction. unsigned: Transaction, /// The V field of the signature; the LS bit described which half of the curve our point falls - /// in. The MS bits describe which network this transaction is for. If 27/28, its for all networks. + /// in. The MS bits describe which network this transaction is for. If 27/28, its for all networks. v: u8, /// The R field of the signature; helps describe the point on the curve. r: U256, @@ -304,7 +304,7 @@ impl SignedTransaction { /// 0 if `v` would have been 27 under "Electrum" notation, 1 if 28 or 4 if invalid. pub fn standard_v(&self) -> u8 { match self.v { v if v == 27 || v == 28 || v > 36 => (v - 1) % 2, _ => 4 } } - /// The network ID, or `None` if this is a global transaction. + /// The network ID, or `None` if this is a global transaction. pub fn network_id(&self) -> Option { match self.v { v if v > 36 => Some((v - 35) / 2), @@ -461,7 +461,7 @@ fn should_agree_with_vitalik() { let signed: SignedTransaction = decode(&FromHex::from_hex(tx_data).unwrap()); signed.check_low_s().unwrap(); assert_eq!(signed.sender().unwrap(), address.into()); - flushln!("networkid: {:?}", signed.network_id()); + flushln!("networkid: {:?}", signed.network_id()); }; test_vector("f864808504a817c800825208943535353535353535353535353535353535353535808025a0044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116da0044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d", "0xf0f6f18bca1b28cd68e4357452947e021241e9ce") @@ -474,4 +474,4 @@ fn should_agree_with_vitalik() { test_vector("f867078504a817c807830290409435353535353535353535353535353535353535358201578025a052f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021a052f1a9b320cab38e5da8a8f97989383aab0a49165fc91c737310e4f7e9821021", "0xd37922162ab7cea97c97a87551ed02c9a38b7332") test_vector("f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10", "0x9bddad43f934d313c2b79ca28a432dd2b7281029") test_vector("f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", "0x3c24d7329e92f84f08556ceb6df1cdb0104ca49f") -} \ No newline at end of file +} diff --git a/parity/run.rs b/parity/run.rs index f56ba5b92..fb70c1eea 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -156,7 +156,7 @@ pub fn execute(cmd: RunCmd, logger: Arc) -> Result<(), String> { // get the mode let mode = try!(mode_switch_to_bool(cmd.mode, &user_defaults)); trace!(target: "mode", "mode is {:?}", mode); - let network_enabled = match &mode { &Mode::Dark(_) | &Mode::Off => false, _ => true, }; + let network_enabled = match mode { Mode::Dark(_) | Mode::Off => false, _ => true, }; // prepare client and snapshot paths. let client_path = db_dirs.client_path(algorithm); diff --git a/rpc/src/v1/types/filter.rs b/rpc/src/v1/types/filter.rs index fc163c54b..77b656a21 100644 --- a/rpc/src/v1/types/filter.rs +++ b/rpc/src/v1/types/filter.rs @@ -125,7 +125,7 @@ mod tests { use serde_json; use std::str::FromStr; use util::hash::*; - use super::*; + use super::{VariadicValue, Topic, Filter}; use v1::types::BlockNumber; use ethcore::filter::Filter as EthFilter; use ethcore::client::BlockID; diff --git a/signer/src/authcode_store.rs b/signer/src/authcode_store.rs index cbb78db41..55c0fcb15 100644 --- a/signer/src/authcode_store.rs +++ b/signer/src/authcode_store.rs @@ -80,6 +80,7 @@ pub struct AuthCodes { impl AuthCodes { /// Reads `AuthCodes` from file and creates new instance using `DefaultTimeProvider`. + #[cfg_attr(feature="dev", allow(single_char_pattern))] pub fn from_file(file: &Path) -> io::Result { let content = { if let Ok(mut file) = fs::File::open(file) { @@ -128,7 +129,7 @@ impl AuthCodes { let mut file = try!(fs::File::create(file)); let content = self.codes.iter().map(|code| { let mut data = vec![code.code.clone(), encode_time(code.created_at.clone())]; - if let Some(used_at) = code.last_used_at.clone() { + if let Some(used_at) = code.last_used_at { data.push(encode_time(used_at)); } data.join(SEPARATOR) diff --git a/signer/src/ws_server/session.rs b/signer/src/ws_server/session.rs index 5adc3fa80..13d253587 100644 --- a/signer/src/ws_server/session.rs +++ b/signer/src/ws_server/session.rs @@ -99,7 +99,7 @@ fn auth_is_valid(codes_path: &Path, protocols: ws::Result>) -> bool { let res = codes.is_valid(&auth, time); // make sure to save back authcodes - it might have been modified - if let Err(_) = codes.to_file(codes_path) { + if codes.to_file(codes_path).is_err() { warn!(target: "signer", "Couldn't save authorization codes to file."); } res diff --git a/sync/src/chain.rs b/sync/src/chain.rs index f27a89c98..f4764c8b1 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -624,7 +624,7 @@ impl ChainSync { Ok(()) } - #[cfg_attr(feature="dev", allow(cyclomatic_complexity))] + #[cfg_attr(feature="dev", allow(cyclomatic_complexity, needless_borrow))] /// Called by peer once it has new block headers during sync fn on_peer_block_headers(&mut self, io: &mut SyncIo, peer_id: PeerId, r: &UntrustedRlp) -> Result<(), PacketDecodeError> { let confirmed = match self.peers.get_mut(&peer_id) { @@ -1173,7 +1173,7 @@ impl ChainSync { } }, SyncState::SnapshotData => { - if let RestorationStatus::Ongoing { state_chunks: _, block_chunks: _, state_chunks_done, block_chunks_done, } = io.snapshot_service().status() { + if let RestorationStatus::Ongoing { state_chunks_done, block_chunks_done, .. } = io.snapshot_service().status() { if self.snapshot.done_chunks() - (state_chunks_done + block_chunks_done) as usize > MAX_SNAPSHOT_CHUNKS_DOWNLOAD_AHEAD { trace!(target: "sync", "Snapshot queue full, pausing sync"); self.state = SyncState::SnapshotWaiting; @@ -1744,7 +1744,7 @@ impl ChainSync { self.restart(io); self.continue_sync(io); }, - RestorationStatus::Ongoing { state_chunks: _, block_chunks: _, state_chunks_done, block_chunks_done, } => { + RestorationStatus::Ongoing { state_chunks_done, block_chunks_done, .. } => { if !self.snapshot.is_complete() && self.snapshot.done_chunks() - (state_chunks_done + block_chunks_done) as usize <= MAX_SNAPSHOT_CHUNKS_DOWNLOAD_AHEAD { trace!(target:"sync", "Resuming snapshot sync"); self.state = SyncState::SnapshotData; @@ -2002,8 +2002,6 @@ mod tests { use tests::snapshot::TestSnapshotService; use super::*; use ::SyncConfig; - use util::*; - use rlp::*; use super::{PeerInfo, PeerAsking}; use ethcore::views::BlockView; use ethcore::header::*; diff --git a/sync/src/tests/helpers.rs b/sync/src/tests/helpers.rs index d5e07a936..2a6d616cb 100644 --- a/sync/src/tests/helpers.rs +++ b/sync/src/tests/helpers.rs @@ -156,19 +156,19 @@ impl TestNet { } pub fn peer(&self, i: usize) -> &TestPeer { - self.peers.get(i).unwrap() + &self.peers[i] } pub fn peer_mut(&mut self, i: usize) -> &mut TestPeer { - self.peers.get_mut(i).unwrap() + &mut self.peers[i] } pub fn start(&mut self) { for peer in 0..self.peers.len() { for client in 0..self.peers.len() { if peer != client { - let mut p = self.peers.get_mut(peer).unwrap(); - p.sync.write().update_targets(&mut p.chain); + let mut p = &mut self.peers[peer]; + p.sync.write().update_targets(&p.chain); p.sync.write().on_peer_connected(&mut TestIo::new(&mut p.chain, &p.snapshot_service, &mut p.queue, Some(client as PeerId)), client as PeerId); } } @@ -179,7 +179,7 @@ impl TestNet { for peer in 0..self.peers.len() { if let Some(packet) = self.peers[peer].queue.pop_front() { let disconnecting = { - let mut p = self.peers.get_mut(packet.recipient).unwrap(); + let mut p = &mut self.peers[packet.recipient]; trace!("--- {} -> {} ---", peer, packet.recipient); let to_disconnect = { let mut io = TestIo::new(&mut p.chain, &p.snapshot_service, &mut p.queue, Some(peer as PeerId)); @@ -195,7 +195,7 @@ impl TestNet { }; for d in &disconnecting { // notify other peers that this peer is disconnecting - let mut p = self.peers.get_mut(*d).unwrap(); + let mut p = &mut self.peers[*d]; let mut io = TestIo::new(&mut p.chain, &p.snapshot_service, &mut p.queue, Some(peer as PeerId)); p.sync.write().on_peer_aborting(&mut io, peer as PeerId); } diff --git a/util/network/src/connection.rs b/util/network/src/connection.rs index 05976b5e6..b99b9931e 100644 --- a/util/network/src/connection.rs +++ b/util/network/src/connection.rs @@ -507,7 +507,6 @@ mod tests { use std::io::{Read, Write, Error, Cursor, ErrorKind}; use mio::{Ready}; use std::collections::VecDeque; - use util::bytes::*; use devtools::*; use io::*; diff --git a/util/network/src/discovery.rs b/util/network/src/discovery.rs index 18bd858eb..d92b576ab 100644 --- a/util/network/src/discovery.rs +++ b/util/network/src/discovery.rs @@ -555,10 +555,6 @@ impl Discovery { #[cfg(test)] mod tests { use super::*; - use util::hash::*; - use util::sha3::*; - use std::net::*; - use node_table::*; use std::str::FromStr; use rustc_serialize::hex::FromHex; use ethkey::{Random, Generator}; diff --git a/util/network/src/handshake.rs b/util/network/src/handshake.rs index d7950b383..4c3c12f31 100644 --- a/util/network/src/handshake.rs +++ b/util/network/src/handshake.rs @@ -333,7 +333,6 @@ mod test { use std::sync::Arc; use rustc_serialize::hex::FromHex; use super::*; - use util::hash::*; use io::*; use mio::tcp::TcpStream; use stats::NetworkStats; diff --git a/util/network/src/node_table.rs b/util/network/src/node_table.rs index be70bd9a1..ef37d5fea 100644 --- a/util/network/src/node_table.rs +++ b/util/network/src/node_table.rs @@ -358,8 +358,6 @@ pub fn is_valid_node_url(url: &str) -> bool { mod tests { use super::*; use std::str::FromStr; - use std::net::*; - use util::hash::*; use devtools::*; use AllowIP; diff --git a/util/src/common.rs b/util/src/common.rs index ea2a0f5ea..681b0baef 100644 --- a/util/src/common.rs +++ b/util/src/common.rs @@ -33,6 +33,13 @@ macro_rules! vec_into { } } +#[macro_export] +macro_rules! slice_into { + ( $( $x:expr ),* ) => { + &[ $( $x.into() ),* ] + } +} + #[macro_export] macro_rules! hash_map { () => { HashMap::new() }; diff --git a/util/src/journaldb/archivedb.rs b/util/src/journaldb/archivedb.rs index a8800045b..639f5f144 100644 --- a/util/src/journaldb/archivedb.rs +++ b/util/src/journaldb/archivedb.rs @@ -236,7 +236,6 @@ mod tests { use common::*; use super::*; - use hashdb::*; use journaldb::traits::JournalDB; use kvdb::Database; diff --git a/util/src/journaldb/earlymergedb.rs b/util/src/journaldb/earlymergedb.rs index d17c0ef1e..9f62f90fa 100644 --- a/util/src/journaldb/earlymergedb.rs +++ b/util/src/journaldb/earlymergedb.rs @@ -556,7 +556,6 @@ mod tests { use common::*; use super::*; use super::super::traits::JournalDB; - use hashdb::*; use log::init_log; use kvdb::{Database, DatabaseConfig}; diff --git a/util/src/journaldb/overlayrecentdb.rs b/util/src/journaldb/overlayrecentdb.rs index 42fe84557..542c59b32 100644 --- a/util/src/journaldb/overlayrecentdb.rs +++ b/util/src/journaldb/overlayrecentdb.rs @@ -422,7 +422,6 @@ mod tests { use common::*; use super::*; - use hashdb::*; use log::init_log; use journaldb::JournalDB; use kvdb::Database; diff --git a/util/src/journaldb/refcounteddb.rs b/util/src/journaldb/refcounteddb.rs index d63f8837d..087318e83 100644 --- a/util/src/journaldb/refcounteddb.rs +++ b/util/src/journaldb/refcounteddb.rs @@ -217,7 +217,6 @@ mod tests { use common::*; use super::*; use super::super::traits::JournalDB; - use hashdb::*; #[test] fn long_history() { diff --git a/util/src/kvdb.rs b/util/src/kvdb.rs index 8be22e0aa..d33f45612 100644 --- a/util/src/kvdb.rs +++ b/util/src/kvdb.rs @@ -628,7 +628,6 @@ impl Drop for Database { #[cfg(test)] mod tests { - use hash::*; use super::*; use devtools::*; use std::str::FromStr; diff --git a/util/src/stats.rs b/util/src/stats.rs index a106ba29c..2a950ff4f 100644 --- a/util/src/stats.rs +++ b/util/src/stats.rs @@ -67,7 +67,7 @@ mod tests { #[test] fn check_histogram() { - let hist = Histogram::new(&vec_into![643,689,1408,2000,2296,2512,4250,4320,4842,4958,5804,6065,6098,6354,7002,7145,7845,8589,8593,8895], 5).unwrap(); + let hist = Histogram::new(slice_into![643,689,1408,2000,2296,2512,4250,4320,4842,4958,5804,6065,6098,6354,7002,7145,7845,8589,8593,8895], 5).unwrap(); let correct_bounds: Vec = vec_into![643, 2294, 3945, 5596, 7247, 8898]; assert_eq!(Histogram { bucket_bounds: correct_bounds, counts: vec![4,2,4,6,4] }, hist); } @@ -75,7 +75,7 @@ mod tests { #[test] fn smaller_data_range_than_bucket_range() { assert_eq!( - Histogram::new(&vec_into![1, 2, 2], 3), + Histogram::new(slice_into![1, 2, 2], 3), Some(Histogram { bucket_bounds: vec_into![1, 2, 3, 4], counts: vec![1, 2, 0] }) ); } @@ -83,7 +83,7 @@ mod tests { #[test] fn data_range_is_not_multiple_of_bucket_range() { assert_eq!( - Histogram::new(&vec_into![1, 2, 5], 2), + Histogram::new(slice_into![1, 2, 5], 2), Some(Histogram { bucket_bounds: vec_into![1, 4, 7], counts: vec![2, 1] }) ); } @@ -91,13 +91,13 @@ mod tests { #[test] fn data_range_is_multiple_of_bucket_range() { assert_eq!( - Histogram::new(&vec_into![1, 2, 6], 2), + Histogram::new(slice_into![1, 2, 6], 2), Some(Histogram { bucket_bounds: vec_into![1, 4, 7], counts: vec![2, 1] }) ); } #[test] fn none_when_too_few_data() { - assert!(Histogram::new(&vec_into![], 1).is_none()); + assert!(Histogram::new(slice_into![], 1).is_none()); } } From 64b1b898f132c12ed382aa70221089220564c8d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Mon, 28 Nov 2016 17:05:37 +0100 Subject: [PATCH 3/4] Fixing compilation on stable --- ethcore/src/executive.rs | 4 ++++ ethcore/src/miner/miner.rs | 3 +++ ethcore/src/miner/transaction_queue.rs | 1 + ethcore/src/state/account.rs | 2 +- sync/src/chain.rs | 6 ++++++ util/network/src/connection.rs | 1 + util/network/src/discovery.rs | 5 +++++ util/network/src/handshake.rs | 1 + util/network/src/node_table.rs | 2 ++ util/src/journaldb/archivedb.rs | 1 + util/src/journaldb/earlymergedb.rs | 1 + util/src/journaldb/overlayrecentdb.rs | 1 + util/src/journaldb/refcounteddb.rs | 1 + util/src/kvdb.rs | 1 + 14 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index f9178f766..3344c0c0a 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -514,8 +514,12 @@ impl<'a> Executive<'a> { #[cfg(test)] #[allow(dead_code)] mod tests { + use std::sync::Arc; use ethkey::{Generator, Random}; use super::*; + use util::{H256, U256, U512, Address, Uint, FixedHash, FromHex, FromStr}; + use util::bytes::BytesRef; + use rlp::{UntrustedRlp, RlpType}; use action_params::{ActionParams, ActionValue}; use env_info::EnvInfo; use evm::{Factory, VMType}; diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index ef8508749..a543e608d 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -1141,9 +1141,12 @@ impl MinerService for Miner { #[cfg(test)] mod tests { + use std::sync::Arc; use std::time::Duration; use super::super::{MinerService, PrioritizationStrategy}; use super::*; + use block::IsBlock; + use util::{U256, Uint, FromHex}; use ethkey::{Generator, Random}; use client::{BlockChainClient, TestBlockChainClient, EachBlockWith, TransactionImportResult}; use header::BlockNumber; diff --git a/ethcore/src/miner/transaction_queue.rs b/ethcore/src/miner/transaction_queue.rs index b8dadee9e..cd2d3ba47 100644 --- a/ethcore/src/miner/transaction_queue.rs +++ b/ethcore/src/miner/transaction_queue.rs @@ -1217,6 +1217,7 @@ mod test { use super::{TransactionSet, TransactionOrder, VerifiedTransaction}; use miner::local_transactions::LocalTransactionsList; use client::TransactionImportResult; + use transaction::{SignedTransaction, Transaction, Action}; fn unwrap_tx_err(err: Result) -> TransactionError { match err.unwrap_err() { diff --git a/ethcore/src/state/account.rs b/ethcore/src/state/account.rs index 584ab0936..ca20d8900 100644 --- a/ethcore/src/state/account.rs +++ b/ethcore/src/state/account.rs @@ -445,7 +445,7 @@ impl fmt::Debug for Account { #[cfg(test)] mod tests { - + use rlp::{UntrustedRlp, RlpType, View, Compressible}; use util::*; use super::*; use account_db::*; diff --git a/sync/src/chain.rs b/sync/src/chain.rs index f4764c8b1..9f1b3c229 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -1998,8 +1998,14 @@ impl ChainSync { #[cfg(test)] mod tests { + use std::collections::{HashSet, VecDeque}; use tests::helpers::*; use tests::snapshot::TestSnapshotService; + use util::{U256, RwLock}; + use util::sha3::Hashable; + use util::hash::{H256, FixedHash}; + use util::bytes::Bytes; + use rlp::{Rlp, RlpStream, UntrustedRlp, View, Stream}; use super::*; use ::SyncConfig; use super::{PeerInfo, PeerAsking}; diff --git a/util/network/src/connection.rs b/util/network/src/connection.rs index b99b9931e..ea0763b09 100644 --- a/util/network/src/connection.rs +++ b/util/network/src/connection.rs @@ -507,6 +507,7 @@ mod tests { use std::io::{Read, Write, Error, Cursor, ErrorKind}; use mio::{Ready}; use std::collections::VecDeque; + use util::bytes::Bytes; use devtools::*; use io::*; diff --git a/util/network/src/discovery.rs b/util/network/src/discovery.rs index d92b576ab..996578af5 100644 --- a/util/network/src/discovery.rs +++ b/util/network/src/discovery.rs @@ -555,6 +555,11 @@ impl Discovery { #[cfg(test)] mod tests { use super::*; + use std::net::{SocketAddr}; + use util::sha3::Hashable; + use util::FixedHash; + use node_table::{Node, NodeId, NodeEndpoint}; + use std::str::FromStr; use rustc_serialize::hex::FromHex; use ethkey::{Random, Generator}; diff --git a/util/network/src/handshake.rs b/util/network/src/handshake.rs index 4c3c12f31..0eeda3b54 100644 --- a/util/network/src/handshake.rs +++ b/util/network/src/handshake.rs @@ -333,6 +333,7 @@ mod test { use std::sync::Arc; use rustc_serialize::hex::FromHex; use super::*; + use util::hash::{H256, FixedHash}; use io::*; use mio::tcp::TcpStream; use stats::NetworkStats; diff --git a/util/network/src/node_table.rs b/util/network/src/node_table.rs index ef37d5fea..ab7d17fa9 100644 --- a/util/network/src/node_table.rs +++ b/util/network/src/node_table.rs @@ -357,6 +357,8 @@ pub fn is_valid_node_url(url: &str) -> bool { #[cfg(test)] mod tests { use super::*; + use std::net::{SocketAddr, SocketAddrV4, Ipv4Addr}; + use util::H512; use std::str::FromStr; use devtools::*; use AllowIP; diff --git a/util/src/journaldb/archivedb.rs b/util/src/journaldb/archivedb.rs index 639f5f144..4c8d24701 100644 --- a/util/src/journaldb/archivedb.rs +++ b/util/src/journaldb/archivedb.rs @@ -235,6 +235,7 @@ mod tests { #![cfg_attr(feature="dev", allow(similar_names))] use common::*; + use hashdb::{HashDB, DBValue}; use super::*; use journaldb::traits::JournalDB; use kvdb::Database; diff --git a/util/src/journaldb/earlymergedb.rs b/util/src/journaldb/earlymergedb.rs index 9f62f90fa..60263a2cd 100644 --- a/util/src/journaldb/earlymergedb.rs +++ b/util/src/journaldb/earlymergedb.rs @@ -554,6 +554,7 @@ mod tests { #![cfg_attr(feature="dev", allow(similar_names))] use common::*; + use hashdb::{HashDB, DBValue}; use super::*; use super::super::traits::JournalDB; use log::init_log; diff --git a/util/src/journaldb/overlayrecentdb.rs b/util/src/journaldb/overlayrecentdb.rs index 542c59b32..34f942a0b 100644 --- a/util/src/journaldb/overlayrecentdb.rs +++ b/util/src/journaldb/overlayrecentdb.rs @@ -422,6 +422,7 @@ mod tests { use common::*; use super::*; + use hashdb::{HashDB, DBValue}; use log::init_log; use journaldb::JournalDB; use kvdb::Database; diff --git a/util/src/journaldb/refcounteddb.rs b/util/src/journaldb/refcounteddb.rs index 087318e83..82261965c 100644 --- a/util/src/journaldb/refcounteddb.rs +++ b/util/src/journaldb/refcounteddb.rs @@ -215,6 +215,7 @@ mod tests { #![cfg_attr(feature="dev", allow(similar_names))] use common::*; + use hashdb::{HashDB, DBValue}; use super::*; use super::super::traits::JournalDB; diff --git a/util/src/kvdb.rs b/util/src/kvdb.rs index d33f45612..de3b033ec 100644 --- a/util/src/kvdb.rs +++ b/util/src/kvdb.rs @@ -628,6 +628,7 @@ impl Drop for Database { #[cfg(test)] mod tests { + use hash::H256; use super::*; use devtools::*; use std::str::FromStr; From 762d8b89d6e26a6925eef145231cae1c0ed992f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Tue, 29 Nov 2016 14:03:21 +0100 Subject: [PATCH 4/4] Removing unused imports --- ethcore/src/executive.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index 3344c0c0a..1dfd987c1 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -519,7 +519,6 @@ mod tests { use super::*; use util::{H256, U256, U512, Address, Uint, FixedHash, FromHex, FromStr}; use util::bytes::BytesRef; - use rlp::{UntrustedRlp, RlpType}; use action_params::{ActionParams, ActionValue}; use env_info::EnvInfo; use evm::{Factory, VMType};