Fix warnings: unused

This commit is contained in:
adria0 2020-07-29 10:57:15 +02:00 committed by Artem Vorotnikov
parent 0cd972326c
commit cacbf256fe
No known key found for this signature in database
GPG Key ID: E0148C3F2FBB7A20
23 changed files with 21 additions and 55 deletions

View File

@ -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. /// Create a new file and restrict permissions to owner only. It errors if the file already exists.
#[cfg(unix)] #[cfg(unix)]
pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> { pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
use libc;
use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::OpenOptionsExt;
fs::OpenOptions::new() 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. /// Create a new file and restrict permissions to owner only. It replaces the existing file if it already exists.
#[cfg(unix)] #[cfg(unix)]
pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> { pub fn replace_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
use libc;
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
let file = fs::File::create(file_path)?; let file = fs::File::create(file_path)?;

View File

@ -17,7 +17,6 @@
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use std::{ use std::{
collections::{BTreeMap, HashMap}, collections::{BTreeMap, HashMap},
mem,
num::NonZeroU32, num::NonZeroU32,
path::PathBuf, path::PathBuf,
time::{Duration, Instant}, time::{Duration, Instant},
@ -454,7 +453,7 @@ impl EthMultiStore {
} }
} }
mem::replace(&mut *cache, new_accounts); *cache = new_accounts;
Ok(()) Ok(())
} }

View File

@ -29,7 +29,6 @@ use bytes::BytesRef;
use criterion::{Bencher, Criterion}; use criterion::{Bencher, Criterion};
use ethcore::{ethereum::new_byzantium_test_machine, machine::EthereumMachine}; use ethcore::{ethereum::new_byzantium_test_machine, machine::EthereumMachine};
use ethcore_builtin::Builtin; use ethcore_builtin::Builtin;
use ethereum_types::U256;
use rustc_hex::FromHex; use rustc_hex::FromHex;
lazy_static! { lazy_static! {

View File

@ -2002,8 +2002,6 @@ mod tests {
block: encoded::Block, block: encoded::Block,
receipts: Vec<Receipt>, receipts: Vec<Receipt>,
) -> ImportRoute { ) -> ImportRoute {
use crate::ExtrasInsert;
let fork_choice = { let fork_choice = {
let header = block.header_view(); let header = block.header_view();
let parent_hash = header.parent_hash(); let parent_hash = header.parent_hash();

View File

@ -21,7 +21,7 @@ use std::{
io::{BufRead, BufReader}, io::{BufRead, BufReader},
str::{from_utf8, FromStr}, str::{from_utf8, FromStr},
sync::{ sync::{
atomic::{AtomicBool, AtomicI64, AtomicUsize, Ordering as AtomicOrdering}, atomic::{AtomicBool, AtomicI64, Ordering as AtomicOrdering},
Arc, Weak, Arc, Weak,
}, },
time::{Duration, Instant}, time::{Duration, Instant},
@ -75,7 +75,7 @@ use engines::{
}; };
use error::{ use error::{
BlockError, CallError, Error as EthcoreError, ErrorKind as EthcoreErrorKind, EthcoreResult, BlockError, CallError, Error as EthcoreError, ErrorKind as EthcoreErrorKind, EthcoreResult,
ExecutionError, ImportError, ImportErrorKind, QueueError, QueueErrorKind, ExecutionError, ImportErrorKind,
}; };
use executive::{contract_address, Executed, Executive, TransactOptions}; use executive::{contract_address, Executed, Executive, TransactOptions};
use factory::{Factories, VmFactory}; use factory::{Factories, VmFactory};
@ -3196,10 +3196,7 @@ impl IoChannelQueue {
mod tests { mod tests {
use blockchain::{BlockProvider, ExtrasInsert}; use blockchain::{BlockProvider, ExtrasInsert};
use spec::Spec; use spec::Spec;
use test_helpers::{ use test_helpers::generate_dummy_client_with_spec_and_data;
generate_dummy_client, generate_dummy_client_with_data,
generate_dummy_client_with_spec_and_data, get_good_dummy_block_hash,
};
#[test] #[test]
fn should_not_cache_details_before_commit() { fn should_not_cache_details_before_commit() {

View File

@ -18,7 +18,6 @@
use std::{ use std::{
collections::{BTreeMap, HashMap}, collections::{BTreeMap, HashMap},
mem,
sync::{ sync::{
atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrder}, atomic::{AtomicBool, AtomicUsize, Ordering as AtomicOrder},
Arc, Arc,
@ -624,7 +623,7 @@ impl ImportBlock for TestBlockChainClient {
let mut difficulty = self.difficulty.write(); let mut difficulty = self.difficulty.write();
*difficulty = *difficulty + header.difficulty().clone(); *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.blocks.write().insert(h.clone(), unverified.bytes);
self.numbers.write().insert(number, h.clone()); self.numbers.write().insert(number, h.clone());
let mut parent_hash = header.parent_hash().clone(); let mut parent_hash = header.parent_hash().clone();

View File

@ -67,7 +67,6 @@ use std::{
use super::signer::EngineSigner; use super::signer::EngineSigner;
use block::ExecutedBlock; use block::ExecutedBlock;
use bytes::Bytes;
use client::{traits::ForceUpdateSealing, BlockId, EngineClient}; use client::{traits::ForceUpdateSealing, BlockId, EngineClient};
use engines::{ use engines::{
clique::util::{extract_signers, recover_creator}, clique::util::{extract_signers, recover_creator},

View File

@ -61,7 +61,6 @@ extern crate ansi_term;
extern crate byteorder; extern crate byteorder;
extern crate common_types as types; extern crate common_types as types;
extern crate crossbeam_utils; extern crate crossbeam_utils;
extern crate eip_152;
extern crate ethabi; extern crate ethabi;
extern crate ethash; extern crate ethash;
extern crate ethcore_blockchain as blockchain; extern crate ethcore_blockchain as blockchain;
@ -81,7 +80,6 @@ extern crate journaldb;
extern crate keccak_hash as hash; extern crate keccak_hash as hash;
extern crate keccak_hasher; extern crate keccak_hasher;
extern crate kvdb; extern crate kvdb;
extern crate kvdb_memorydb;
extern crate len_caching_lock; extern crate len_caching_lock;
extern crate lru_cache; extern crate lru_cache;
extern crate memory_cache; extern crate memory_cache;
@ -121,9 +119,6 @@ extern crate kvdb_rocksdb;
extern crate rlp_compress; extern crate rlp_compress;
#[cfg(any(test, feature = "tempdir"))] #[cfg(any(test, feature = "tempdir"))]
extern crate tempdir; extern crate tempdir;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[macro_use] #[macro_use]
extern crate ethabi_derive; extern crate ethabi_derive;

View File

@ -1990,7 +1990,6 @@ mod tests {
use ethcore_miner::gas_price_calibrator::{GasPriceCalibrator, GasPriceCalibratorOptions}; use ethcore_miner::gas_price_calibrator::{GasPriceCalibrator, GasPriceCalibratorOptions};
use fetch::Client as FetchClient; use fetch::Client as FetchClient;
use parity_runtime::Executor; use parity_runtime::Executor;
use std::time::Duration;
// Don't really care about any of these settings since // Don't really care about any of these settings since
// the gas pricer is never actually going to be used // the gas pricer is never actually going to be used

View File

@ -163,7 +163,6 @@ pub fn restore(
reader: &dyn SnapshotReader, reader: &dyn SnapshotReader,
genesis: &[u8], genesis: &[u8],
) -> Result<(), ::error::Error> { ) -> Result<(), ::error::Error> {
use snappy;
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
let flag = AtomicBool::new(true); let flag = AtomicBool::new(true);

View File

@ -206,7 +206,7 @@ fn keep_ancient_blocks() {
) )
.unwrap(); .unwrap();
let manifest = ::snapshot::ManifestData { let manifest = ManifestData {
version: 2, version: 2,
state_hashes, state_hashes,
state_root, state_root,

View File

@ -901,8 +901,6 @@ impl Spec {
/// initialize genesis epoch data, using in-memory database for /// initialize genesis epoch data, using in-memory database for
/// constructor. /// constructor.
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String> { pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String> {
use journaldb;
use kvdb_memorydb;
use types::transaction::{Action, Transaction}; use types::transaction::{Action, Transaction};
let genesis = self.genesis_header(); let genesis = self.genesis_header();

View File

@ -33,7 +33,7 @@ use hash::keccak;
use io::IoChannel; use io::IoChannel;
use miner::{Miner, MinerService, PendingOrdering}; use miner::{Miner, MinerService, PendingOrdering};
use rustc_hex::ToHex; use rustc_hex::ToHex;
use spec::{self, Spec}; use spec::Spec;
use state::{self, CleanupMode, State, StateInfo}; use state::{self, CleanupMode, State, StateInfo};
use tempdir::TempDir; use tempdir::TempDir;
use test_helpers::{ use test_helpers::{

View File

@ -15,14 +15,6 @@
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>. // along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
//! Cost schedule and other parameterisations for the EVM. //! 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. /// Definition of the cost schedule and other parameterisations for the EVM.
#[derive(Debug)] #[derive(Debug)]

View File

@ -152,7 +152,6 @@ mod tests {
}; };
use macros::map; use macros::map;
use serde_json; use serde_json;
use uint::Uint;
#[test] #[test]
fn builtin_deserialization() { fn builtin_deserialization() {

View File

@ -37,9 +37,7 @@ pub struct Clique {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use ethereum_types::U256;
use serde_json; use serde_json;
use uint::Uint;
#[test] #[test]
fn clique_deserialization() { fn clique_deserialization() {

View File

@ -105,7 +105,7 @@ impl ServiceTransactionChecker {
let allowed = self.call_contract(client, contract_address, *address)?; let allowed = self.call_contract(client, contract_address, *address)?;
cache.insert(*address, allowed); cache.insert(*address, allowed);
} }
mem::replace(&mut *self.certified_addresses_cache.write(), cache); *self.certified_addresses_cache.write() = cache;
Ok(true) Ok(true)
} else { } else {
Ok(false) Ok(false)

View File

@ -30,12 +30,12 @@ use db;
use dir::Directories; use dir::Directories;
use ethcore::{ use ethcore::{
client::{ client::{
Balance, BlockChainClient, BlockChainReset, BlockId, BlockInfo, DatabaseCompactionProfile, Balance, BlockChainClient, BlockChainReset, BlockId, DatabaseCompactionProfile,
ImportBlock, ImportExportBlocks, Mode, Nonce, VMType, ImportExportBlocks, Mode, Nonce, VMType,
}, },
error::{Error as EthcoreError, ErrorKind as EthcoreErrorKind, ImportErrorKind}, error::{Error as EthcoreError, ErrorKind as EthcoreErrorKind, ImportErrorKind},
miner::Miner, miner::Miner,
verification::queue::{kind::blocks::Unverified, VerifierSettings}, verification::queue::VerifierSettings,
}; };
use ethcore_private_tx; use ethcore_private_tx;
use ethcore_service::ClientService; use ethcore_service::ClientService;

View File

@ -44,7 +44,7 @@ impl ethcore::engines::EngineSigner for EngineSigner {
.sign(self.address, Some(self.password.clone()), message) .sign(self.address, Some(self.password.clone()), message)
{ {
Ok(ok) => Ok(ok), Ok(ok) => Ok(ok),
Err(e) => Err(ethkey::Error::InvalidSecret), Err(_e) => Err(ethkey::Error::InvalidSecret),
} }
} }

View File

@ -21,7 +21,6 @@ use serde::{
use std::fmt; use std::fmt;
use ethereum_types::H256; use ethereum_types::H256;
use ethstore;
/// Type of derivation /// Type of derivation
pub enum DerivationType { pub enum DerivationType {
@ -32,6 +31,7 @@ pub enum DerivationType {
} }
/// Derivation request by hash /// Derivation request by hash
#[allow(dead_code)]
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct DeriveHash { pub struct DeriveHash {
hash: H256, hash: H256,
@ -40,6 +40,7 @@ pub struct DeriveHash {
} }
/// Node propertoes in hierarchical derivation request /// Node propertoes in hierarchical derivation request
#[allow(dead_code)]
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct DeriveHierarchicalItem { pub struct DeriveHierarchicalItem {
index: u64, index: u64,

View File

@ -767,7 +767,7 @@ mod tests {
ContinueAction, FailedContinueAction, FastestResultComputer, LargestSupportResultComputer, ContinueAction, FailedContinueAction, FastestResultComputer, LargestSupportResultComputer,
SessionImpl, SessionParams, SessionResultComputer, SessionState, SessionTransport, SessionImpl, SessionParams, SessionResultComputer, SessionState, SessionTransport,
}; };
use ethereum_types::{Address, H160, H512}; use ethereum_types::{H160, H512};
use ethkey::public_to_address; use ethkey::public_to_address;
use key_server_cluster::{ use key_server_cluster::{
admin_sessions::ShareChangeSessionMeta, admin_sessions::ShareChangeSessionMeta,

View File

@ -556,19 +556,16 @@ impl ClusterSessionsContainerState {
pub fn on_session_starting(&mut self, is_exclusive_session: bool) -> Result<(), Error> { pub fn on_session_starting(&mut self, is_exclusive_session: bool) -> Result<(), Error> {
match *self { match *self {
ClusterSessionsContainerState::Idle if is_exclusive_session => { ClusterSessionsContainerState::Idle if is_exclusive_session => {
::std::mem::replace(self, ClusterSessionsContainerState::Exclusive); *self = ClusterSessionsContainerState::Exclusive;
} }
ClusterSessionsContainerState::Idle => { ClusterSessionsContainerState::Idle => {
::std::mem::replace(self, ClusterSessionsContainerState::Active(1)); *self = ClusterSessionsContainerState::Active(1);
} }
ClusterSessionsContainerState::Active(_) if is_exclusive_session => { ClusterSessionsContainerState::Active(_) if is_exclusive_session => {
return Err(Error::HasActiveSessions) return Err(Error::HasActiveSessions)
} }
ClusterSessionsContainerState::Active(sessions_count) => { 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), ClusterSessionsContainerState::Exclusive => return Err(Error::ExclusiveSessionActive),
} }
@ -581,13 +578,13 @@ impl ClusterSessionsContainerState {
ClusterSessionsContainerState::Idle => ClusterSessionsContainerState::Idle =>
unreachable!("idle means that there are no active sessions; on_session_completed is only called once after active session is completed; qed"), 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 => { ClusterSessionsContainerState::Active(sessions_count) if sessions_count == 1 => {
::std::mem::replace(self, ClusterSessionsContainerState::Idle); *self = ClusterSessionsContainerState::Idle;
}, },
ClusterSessionsContainerState::Active(sessions_count) => { ClusterSessionsContainerState::Active(sessions_count) => {
::std::mem::replace(self, ClusterSessionsContainerState::Active(sessions_count - 1)); *self = ClusterSessionsContainerState::Active(sessions_count - 1);
} }
ClusterSessionsContainerState::Exclusive => { ClusterSessionsContainerState::Exclusive => {
::std::mem::replace(self, ClusterSessionsContainerState::Idle); *self = ClusterSessionsContainerState::Idle;
}, },
} }
} }

View File

@ -45,7 +45,6 @@ extern crate bitflags;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[macro_use]
extern crate serde_derive; extern crate serde_derive;
#[cfg(not(time_checked_add))] #[cfg(not(time_checked_add))]