diff --git a/accounts/ethstore/src/accounts_dir/disk.rs b/accounts/ethstore/src/accounts_dir/disk.rs index e6695a8d5..e3768bcf9 100644 --- a/accounts/ethstore/src/accounts_dir/disk.rs +++ b/accounts/ethstore/src/accounts_dir/disk.rs @@ -72,7 +72,6 @@ pub fn find_unique_filename_using_random_suffix( /// Create a new file and restrict permissions to owner only. It errors if the file already exists. #[cfg(unix)] pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result { - use libc; use std::os::unix::fs::OpenOptionsExt; fs::OpenOptions::new() @@ -94,7 +93,6 @@ pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result /// Create a new file and restrict permissions to owner only. It replaces the existing file if it already exists. #[cfg(unix)] pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result { - use libc; use std::os::unix::fs::PermissionsExt; let file = fs::File::create(file_path)?; diff --git a/accounts/ethstore/src/ethstore.rs b/accounts/ethstore/src/ethstore.rs index 4846ec1a7..ef9bef3bf 100644 --- a/accounts/ethstore/src/ethstore.rs +++ b/accounts/ethstore/src/ethstore.rs @@ -17,7 +17,6 @@ use parking_lot::{Mutex, RwLock}; use std::{ collections::{BTreeMap, HashMap}, - mem, num::NonZeroU32, path::PathBuf, time::{Duration, Instant}, @@ -454,7 +453,7 @@ impl EthMultiStore { } } - mem::replace(&mut *cache, new_accounts); + *cache = new_accounts; Ok(()) } diff --git a/ethcore/benches/builtin.rs b/ethcore/benches/builtin.rs index b25ab7745..73e193cf3 100644 --- a/ethcore/benches/builtin.rs +++ b/ethcore/benches/builtin.rs @@ -29,7 +29,6 @@ use bytes::BytesRef; use criterion::{Bencher, Criterion}; use ethcore::{ethereum::new_byzantium_test_machine, machine::EthereumMachine}; use ethcore_builtin::Builtin; -use ethereum_types::U256; use rustc_hex::FromHex; lazy_static! { diff --git a/ethcore/blockchain/src/blockchain.rs b/ethcore/blockchain/src/blockchain.rs index 02cbaf108..8c06b9977 100644 --- a/ethcore/blockchain/src/blockchain.rs +++ b/ethcore/blockchain/src/blockchain.rs @@ -2002,8 +2002,6 @@ mod tests { block: encoded::Block, receipts: Vec, ) -> ImportRoute { - use crate::ExtrasInsert; - let fork_choice = { let header = block.header_view(); let parent_hash = header.parent_hash(); diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 0fc8f0ecc..73428c4d8 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -21,7 +21,7 @@ use std::{ io::{BufRead, BufReader}, str::{from_utf8, FromStr}, sync::{ - atomic::{AtomicBool, AtomicI64, AtomicUsize, Ordering as AtomicOrdering}, + atomic::{AtomicBool, AtomicI64, Ordering as AtomicOrdering}, Arc, Weak, }, time::{Duration, Instant}, @@ -75,7 +75,7 @@ use engines::{ }; use error::{ BlockError, CallError, Error as EthcoreError, ErrorKind as EthcoreErrorKind, EthcoreResult, - ExecutionError, ImportError, ImportErrorKind, QueueError, QueueErrorKind, + ExecutionError, ImportErrorKind, }; use executive::{contract_address, Executed, Executive, TransactOptions}; use factory::{Factories, VmFactory}; @@ -3196,10 +3196,7 @@ impl IoChannelQueue { mod tests { use blockchain::{BlockProvider, ExtrasInsert}; use spec::Spec; - use test_helpers::{ - generate_dummy_client, generate_dummy_client_with_data, - generate_dummy_client_with_spec_and_data, get_good_dummy_block_hash, - }; + use test_helpers::generate_dummy_client_with_spec_and_data; #[test] fn should_not_cache_details_before_commit() { diff --git a/ethcore/src/client/test_client.rs b/ethcore/src/client/test_client.rs index b6bcbeb0b..808cbf3f7 100644 --- a/ethcore/src/client/test_client.rs +++ b/ethcore/src/client/test_client.rs @@ -18,7 +18,6 @@ use std::{ collections::{BTreeMap, HashMap}, - mem, sync::{ atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrder}, Arc, @@ -624,7 +623,7 @@ impl ImportBlock for TestBlockChainClient { let mut difficulty = self.difficulty.write(); *difficulty = *difficulty + header.difficulty().clone(); } - mem::replace(&mut *self.last_hash.write(), h.clone()); + *self.last_hash.write() = h.clone(); self.blocks.write().insert(h.clone(), unverified.bytes); self.numbers.write().insert(number, h.clone()); let mut parent_hash = header.parent_hash().clone(); diff --git a/ethcore/src/engines/clique/mod.rs b/ethcore/src/engines/clique/mod.rs index 7d1845e6d..696a93c14 100644 --- a/ethcore/src/engines/clique/mod.rs +++ b/ethcore/src/engines/clique/mod.rs @@ -67,7 +67,6 @@ use std::{ use super::signer::EngineSigner; use block::ExecutedBlock; -use bytes::Bytes; use client::{traits::ForceUpdateSealing, BlockId, EngineClient}; use engines::{ clique::util::{extract_signers, recover_creator}, diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index e05ed2584..db185b05f 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -61,7 +61,6 @@ extern crate ansi_term; extern crate byteorder; extern crate common_types as types; extern crate crossbeam_utils; -extern crate eip_152; extern crate ethabi; extern crate ethash; extern crate ethcore_blockchain as blockchain; @@ -81,7 +80,6 @@ extern crate journaldb; extern crate keccak_hash as hash; extern crate keccak_hasher; extern crate kvdb; -extern crate kvdb_memorydb; extern crate len_caching_lock; extern crate lru_cache; extern crate memory_cache; @@ -121,9 +119,6 @@ extern crate kvdb_rocksdb; extern crate rlp_compress; #[cfg(any(test, feature = "tempdir"))] extern crate tempdir; -#[cfg(test)] -#[macro_use] -extern crate hex_literal; #[macro_use] extern crate ethabi_derive; diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index f4a66cfec..9ca4969f3 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -1990,7 +1990,6 @@ mod tests { use ethcore_miner::gas_price_calibrator::{GasPriceCalibrator, GasPriceCalibratorOptions}; use fetch::Client as FetchClient; use parity_runtime::Executor; - use std::time::Duration; // Don't really care about any of these settings since // the gas pricer is never actually going to be used diff --git a/ethcore/src/snapshot/tests/helpers.rs b/ethcore/src/snapshot/tests/helpers.rs index 781eb7799..68ec01590 100644 --- a/ethcore/src/snapshot/tests/helpers.rs +++ b/ethcore/src/snapshot/tests/helpers.rs @@ -163,7 +163,6 @@ pub fn restore( reader: &dyn SnapshotReader, genesis: &[u8], ) -> Result<(), ::error::Error> { - use snappy; use std::sync::atomic::AtomicBool; let flag = AtomicBool::new(true); diff --git a/ethcore/src/snapshot/tests/service.rs b/ethcore/src/snapshot/tests/service.rs index b56f76ec1..e914731d1 100644 --- a/ethcore/src/snapshot/tests/service.rs +++ b/ethcore/src/snapshot/tests/service.rs @@ -206,7 +206,7 @@ fn keep_ancient_blocks() { ) .unwrap(); - let manifest = ::snapshot::ManifestData { + let manifest = ManifestData { version: 2, state_hashes, state_root, diff --git a/ethcore/src/spec/spec.rs b/ethcore/src/spec/spec.rs index e46eb8a44..4ff52a046 100644 --- a/ethcore/src/spec/spec.rs +++ b/ethcore/src/spec/spec.rs @@ -901,8 +901,6 @@ impl Spec { /// initialize genesis epoch data, using in-memory database for /// constructor. pub fn genesis_epoch_data(&self) -> Result, String> { - use journaldb; - use kvdb_memorydb; use types::transaction::{Action, Transaction}; let genesis = self.genesis_header(); diff --git a/ethcore/src/tests/client.rs b/ethcore/src/tests/client.rs index 54d28542c..f3cd1082f 100644 --- a/ethcore/src/tests/client.rs +++ b/ethcore/src/tests/client.rs @@ -33,7 +33,7 @@ use hash::keccak; use io::IoChannel; use miner::{Miner, MinerService, PendingOrdering}; use rustc_hex::ToHex; -use spec::{self, Spec}; +use spec::Spec; use state::{self, CleanupMode, State, StateInfo}; use tempdir::TempDir; use test_helpers::{ diff --git a/ethcore/vm/src/schedule.rs b/ethcore/vm/src/schedule.rs index 925a943d1..3d5fdbc95 100644 --- a/ethcore/vm/src/schedule.rs +++ b/ethcore/vm/src/schedule.rs @@ -15,14 +15,6 @@ // along with Parity Ethereum. If not, see . //! Cost schedule and other parameterisations for the EVM. -use ethereum_types::U256; -use std::collections::HashMap; - -/// Definition of schedules that can be applied to a version. -#[derive(Debug)] -pub enum VersionedSchedule { - PWasm, -} /// Definition of the cost schedule and other parameterisations for the EVM. #[derive(Debug)] diff --git a/json/src/spec/builtin.rs b/json/src/spec/builtin.rs index 24edd4863..9ee134b82 100644 --- a/json/src/spec/builtin.rs +++ b/json/src/spec/builtin.rs @@ -152,7 +152,6 @@ mod tests { }; use macros::map; use serde_json; - use uint::Uint; #[test] fn builtin_deserialization() { diff --git a/json/src/spec/clique.rs b/json/src/spec/clique.rs index e1bb34bb6..a5ef59753 100644 --- a/json/src/spec/clique.rs +++ b/json/src/spec/clique.rs @@ -37,9 +37,7 @@ pub struct Clique { #[cfg(test)] mod tests { use super::*; - use ethereum_types::U256; use serde_json; - use uint::Uint; #[test] fn clique_deserialization() { diff --git a/miner/src/service_transaction_checker.rs b/miner/src/service_transaction_checker.rs index 1188871b8..ffcc109a7 100644 --- a/miner/src/service_transaction_checker.rs +++ b/miner/src/service_transaction_checker.rs @@ -105,7 +105,7 @@ impl ServiceTransactionChecker { let allowed = self.call_contract(client, contract_address, *address)?; cache.insert(*address, allowed); } - mem::replace(&mut *self.certified_addresses_cache.write(), cache); + *self.certified_addresses_cache.write() = cache; Ok(true) } else { Ok(false) diff --git a/parity/blockchain.rs b/parity/blockchain.rs index 519a94543..3d09ca9e4 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -30,12 +30,12 @@ use db; use dir::Directories; use ethcore::{ client::{ - Balance, BlockChainClient, BlockChainReset, BlockId, BlockInfo, DatabaseCompactionProfile, - ImportBlock, ImportExportBlocks, Mode, Nonce, VMType, + Balance, BlockChainClient, BlockChainReset, BlockId, DatabaseCompactionProfile, + ImportExportBlocks, Mode, Nonce, VMType, }, error::{Error as EthcoreError, ErrorKind as EthcoreErrorKind, ImportErrorKind}, miner::Miner, - verification::queue::{kind::blocks::Unverified, VerifierSettings}, + verification::queue::VerifierSettings, }; use ethcore_private_tx; use ethcore_service::ClientService; diff --git a/rpc/src/v1/helpers/engine_signer.rs b/rpc/src/v1/helpers/engine_signer.rs index e0e929850..d10f5201b 100644 --- a/rpc/src/v1/helpers/engine_signer.rs +++ b/rpc/src/v1/helpers/engine_signer.rs @@ -44,7 +44,7 @@ impl ethcore::engines::EngineSigner for EngineSigner { .sign(self.address, Some(self.password.clone()), message) { Ok(ok) => Ok(ok), - Err(e) => Err(ethkey::Error::InvalidSecret), + Err(_e) => Err(ethkey::Error::InvalidSecret), } } diff --git a/rpc/src/v1/types/derivation.rs b/rpc/src/v1/types/derivation.rs index a4d67f109..f4e582813 100644 --- a/rpc/src/v1/types/derivation.rs +++ b/rpc/src/v1/types/derivation.rs @@ -21,7 +21,6 @@ use serde::{ use std::fmt; use ethereum_types::H256; -use ethstore; /// Type of derivation pub enum DerivationType { @@ -32,6 +31,7 @@ pub enum DerivationType { } /// Derivation request by hash +#[allow(dead_code)] #[derive(Deserialize)] pub struct DeriveHash { hash: H256, @@ -40,6 +40,7 @@ pub struct DeriveHash { } /// Node propertoes in hierarchical derivation request +#[allow(dead_code)] #[derive(Deserialize)] pub struct DeriveHierarchicalItem { index: u64, diff --git a/secret-store/src/key_server_cluster/admin_sessions/key_version_negotiation_session.rs b/secret-store/src/key_server_cluster/admin_sessions/key_version_negotiation_session.rs index 8b32ca62c..1ef29ae5e 100644 --- a/secret-store/src/key_server_cluster/admin_sessions/key_version_negotiation_session.rs +++ b/secret-store/src/key_server_cluster/admin_sessions/key_version_negotiation_session.rs @@ -767,7 +767,7 @@ mod tests { ContinueAction, FailedContinueAction, FastestResultComputer, LargestSupportResultComputer, SessionImpl, SessionParams, SessionResultComputer, SessionState, SessionTransport, }; - use ethereum_types::{Address, H160, H512}; + use ethereum_types::{H160, H512}; use ethkey::public_to_address; use key_server_cluster::{ admin_sessions::ShareChangeSessionMeta, diff --git a/secret-store/src/key_server_cluster/cluster_sessions.rs b/secret-store/src/key_server_cluster/cluster_sessions.rs index d88ffb8ce..65d2d22a2 100644 --- a/secret-store/src/key_server_cluster/cluster_sessions.rs +++ b/secret-store/src/key_server_cluster/cluster_sessions.rs @@ -556,19 +556,16 @@ impl ClusterSessionsContainerState { pub fn on_session_starting(&mut self, is_exclusive_session: bool) -> Result<(), Error> { match *self { ClusterSessionsContainerState::Idle if is_exclusive_session => { - ::std::mem::replace(self, ClusterSessionsContainerState::Exclusive); + *self = ClusterSessionsContainerState::Exclusive; } ClusterSessionsContainerState::Idle => { - ::std::mem::replace(self, ClusterSessionsContainerState::Active(1)); + *self = ClusterSessionsContainerState::Active(1); } ClusterSessionsContainerState::Active(_) if is_exclusive_session => { return Err(Error::HasActiveSessions) } ClusterSessionsContainerState::Active(sessions_count) => { - ::std::mem::replace( - self, - ClusterSessionsContainerState::Active(sessions_count + 1), - ); + *self = ClusterSessionsContainerState::Active(sessions_count + 1); } ClusterSessionsContainerState::Exclusive => return Err(Error::ExclusiveSessionActive), } @@ -581,13 +578,13 @@ impl ClusterSessionsContainerState { ClusterSessionsContainerState::Idle => unreachable!("idle means that there are no active sessions; on_session_completed is only called once after active session is completed; qed"), ClusterSessionsContainerState::Active(sessions_count) if sessions_count == 1 => { - ::std::mem::replace(self, ClusterSessionsContainerState::Idle); + *self = ClusterSessionsContainerState::Idle; }, ClusterSessionsContainerState::Active(sessions_count) => { - ::std::mem::replace(self, ClusterSessionsContainerState::Active(sessions_count - 1)); + *self = ClusterSessionsContainerState::Active(sessions_count - 1); } ClusterSessionsContainerState::Exclusive => { - ::std::mem::replace(self, ClusterSessionsContainerState::Idle); + *self = ClusterSessionsContainerState::Idle; }, } } diff --git a/whisper/src/lib.rs b/whisper/src/lib.rs index b38903d42..1b45f58ed 100644 --- a/whisper/src/lib.rs +++ b/whisper/src/lib.rs @@ -45,7 +45,6 @@ extern crate bitflags; #[macro_use] extern crate log; -#[macro_use] extern crate serde_derive; #[cfg(not(time_checked_add))]