From 45f74c396d6a6c7d049dfb040afb2cb82c44537e Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Mon, 8 Mar 2021 10:36:16 -0500 Subject: [PATCH] Remove unused imports (#3589) * Remove unused imports --- core/src/core/committed.rs | 1 - core/src/genesis.rs | 1 - core/src/global.rs | 8 ++++---- core/src/lib.rs | 2 -- core/src/libtx/error.rs | 1 - core/src/libtx/secp_ser.rs | 8 ++++---- core/src/macros.rs | 2 +- core/src/pow.rs | 2 -- core/src/pow/common.rs | 2 +- keychain/src/mnemonic.rs | 2 +- src/build/build.rs | 2 -- util/src/logger.rs | 1 - 12 files changed, 11 insertions(+), 21 deletions(-) diff --git a/core/src/core/committed.rs b/core/src/core/committed.rs index 9fb2d7277a..db6124cdb4 100644 --- a/core/src/core/committed.rs +++ b/core/src/core/committed.rs @@ -15,7 +15,6 @@ //! The Committed trait and associated errors. use failure::Fail; -use keychain; use keychain::BlindingFactor; use util::secp::key::SecretKey; use util::secp::pedersen::Commitment; diff --git a/core/src/genesis.rs b/core/src/genesis.rs index cce553f6ea..aa749500a8 100644 --- a/core/src/genesis.rs +++ b/core/src/genesis.rs @@ -24,7 +24,6 @@ use crate::core::hash::Hash; use crate::pow::{Difficulty, Proof, ProofOfWork}; use chrono::prelude::{TimeZone, Utc}; use keychain::BlindingFactor; -use util; use util::secp::constants::SINGLE_BULLET_PROOF_SIZE; use util::secp::pedersen::{Commitment, RangeProof}; use util::secp::Signature; diff --git a/core/src/global.rs b/core/src/global.rs index de82497df3..a64c2e9bd3 100644 --- a/core/src/global.rs +++ b/core/src/global.rs @@ -17,10 +17,10 @@ //! should be used sparingly. use crate::consensus::{ - graph_weight, header_version, HeaderInfo, BASE_EDGE_BITS, BLOCK_TIME_SEC, - C32_GRAPH_WEIGHT, COINBASE_MATURITY, CUT_THROUGH_HORIZON, DAY_HEIGHT, DEFAULT_MIN_EDGE_BITS, - DMA_WINDOW, GRIN_BASE, INITIAL_DIFFICULTY, KERNEL_WEIGHT, MAX_BLOCK_WEIGHT, - OUTPUT_WEIGHT, PROOFSIZE, SECOND_POW_EDGE_BITS, STATE_SYNC_THRESHOLD, + graph_weight, header_version, HeaderInfo, BASE_EDGE_BITS, BLOCK_TIME_SEC, C32_GRAPH_WEIGHT, + COINBASE_MATURITY, CUT_THROUGH_HORIZON, DAY_HEIGHT, DEFAULT_MIN_EDGE_BITS, DMA_WINDOW, + GRIN_BASE, INITIAL_DIFFICULTY, KERNEL_WEIGHT, MAX_BLOCK_WEIGHT, OUTPUT_WEIGHT, PROOFSIZE, + SECOND_POW_EDGE_BITS, STATE_SYNC_THRESHOLD, }; use crate::core::block::HeaderVersion; use crate::pow::{ diff --git a/core/src/lib.rs b/core/src/lib.rs index bb0b842598..45e59fc494 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -27,10 +27,8 @@ extern crate enum_primitive; extern crate lazy_static; #[macro_use] extern crate serde_derive; -use serde; #[macro_use] extern crate log; -use failure; #[macro_use] extern crate failure_derive; #[macro_use] diff --git a/core/src/libtx/error.rs b/core/src/libtx/error.rs index a6b98c335b..4141be8a26 100644 --- a/core/src/libtx/error.rs +++ b/core/src/libtx/error.rs @@ -15,7 +15,6 @@ //! libtx specific errors use crate::core::transaction; use failure::{Backtrace, Context, Fail}; -use keychain; use std::fmt::{self, Display}; use util::secp; diff --git a/core/src/libtx/secp_ser.rs b/core/src/libtx/secp_ser.rs index b527f3a0f8..54d03343f8 100644 --- a/core/src/libtx/secp_ser.rs +++ b/core/src/libtx/secp_ser.rs @@ -53,8 +53,8 @@ pub mod pubkey_serde { /// Serializes an Option to and from hex pub mod option_sig_serde { - use crate::serde::{Deserialize, Deserializer, Serializer}; use serde::de::Error; + use serde::{Deserialize, Deserializer, Serializer}; use util::{from_hex, secp, static_secp_instance, ToHex}; /// @@ -99,8 +99,8 @@ pub mod option_sig_serde { /// Serializes an Option to and from hex pub mod option_seckey_serde { - use crate::serde::{Deserialize, Deserializer, Serializer}; use serde::de::Error; + use serde::{Deserialize, Deserializer, Serializer}; use util::{from_hex, secp, static_secp_instance, ToHex}; /// @@ -144,8 +144,8 @@ pub mod option_seckey_serde { /// Serializes a secp::Signature to and from hex pub mod sig_serde { - use crate::serde::{Deserialize, Deserializer, Serializer}; use serde::de::Error; + use serde::{Deserialize, Deserializer, Serializer}; use util::{from_hex, secp, static_secp_instance, ToHex}; /// @@ -180,8 +180,8 @@ pub mod sig_serde { /// Serializes an Option to and from hex pub mod option_commitment_serde { - use crate::serde::{Deserialize, Deserializer, Serializer}; use serde::de::Error; + use serde::{Deserialize, Deserializer, Serializer}; use util::secp::pedersen::Commitment; use util::{from_hex, ToHex}; diff --git a/core/src/macros.rs b/core/src/macros.rs index 05bc78bc94..32243b7be8 100644 --- a/core/src/macros.rs +++ b/core/src/macros.rs @@ -60,7 +60,7 @@ macro_rules! tee { ($thing:ident, $thing_expr:expr) => {{ $thing_expr; $thing - }}; + }}; } /// Eliminate some of the boilerplate of deserialization (package ser) by diff --git a/core/src/pow.rs b/core/src/pow.rs index 8e07d9421b..689de94d6e 100644 --- a/core/src/pow.rs +++ b/core/src/pow.rs @@ -33,8 +33,6 @@ pub use self::types::*; use crate::core::{Block, BlockHeader}; use crate::genesis; use crate::global; -use chrono; -use num; #[macro_use] mod common; diff --git a/core/src/pow/common.rs b/core/src/pow/common.rs index ddb24eb862..ddd0875b37 100644 --- a/core/src/pow/common.rs +++ b/core/src/pow/common.rs @@ -15,10 +15,10 @@ //! Common types and traits for cuckoo family of solvers use crate::pow::error::Error; -use crate::pow::num::{PrimInt, ToPrimitive}; use crate::pow::siphash::siphash24; use blake2::blake2b::blake2b; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; +use num::{PrimInt, ToPrimitive}; use std::fmt; use std::hash::Hash; use std::io::Cursor; diff --git a/keychain/src/mnemonic.rs b/keychain/src/mnemonic.rs index e216236b6b..9a26155b22 100644 --- a/keychain/src/mnemonic.rs +++ b/keychain/src/mnemonic.rs @@ -99,7 +99,7 @@ pub fn to_entropy(mnemonic: &str) -> Result, Error> { let mut hash = [0; 32]; let mut sha2sum = Sha256::default(); - sha2sum.input(&entropy.clone()); + sha2sum.input(&entropy); hash.copy_from_slice(sha2sum.result().as_slice()); let actual = (hash[0] >> (8 - checksum_bits)) & mask; diff --git a/src/build/build.rs b/src/build/build.rs index 44e2674e67..78655c4402 100644 --- a/src/build/build.rs +++ b/src/build/build.rs @@ -14,8 +14,6 @@ //! Build hooks to spit out version+build time info -use built; - use std::env; use std::path::{Path, PathBuf}; use std::process::Command; diff --git a/util/src/logger.rs b/util/src/logger.rs index f445919b82..918ca22995 100644 --- a/util/src/logger.rs +++ b/util/src/logger.rs @@ -19,7 +19,6 @@ use backtrace::Backtrace; use std::{panic, thread}; use log::{Level, Record}; -use log4rs; use log4rs::append::console::ConsoleAppender; use log4rs::append::file::FileAppender; use log4rs::append::rolling_file::{