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.
#[cfg(unix)]
pub fn create_new_file_with_permissions_to_owner(file_path: &Path) -> io::Result<fs::File> {
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<fs::File> {
use libc;
use std::os::unix::fs::PermissionsExt;
let file = fs::File::create(file_path)?;

View File

@ -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(())
}

View File

@ -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! {

View File

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

View File

@ -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() {

View File

@ -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();

View File

@ -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},

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

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

View File

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

View File

@ -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::{

View File

@ -15,14 +15,6 @@
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
//! 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)]

View File

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

View File

@ -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() {

View File

@ -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)

View File

@ -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;

View File

@ -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),
}
}

View File

@ -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,

View File

@ -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,

View File

@ -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;
},
}
}

View File

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