From c11abf88b781ea73180d58a88f39bf2a041ce945 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 27 Apr 2020 16:54:11 -0700 Subject: [PATCH] Clean up `use` to keep rust 1.43.0 from complaining (#9740) --- archiver-lib/src/result.rs | 1 - core/src/crds_gossip_pull.rs | 1 - core/src/poh_service.rs | 2 -- install/src/main-install-init.rs | 1 - keygen/src/keygen.rs | 2 -- ledger-tool/src/main.rs | 1 - ledger/src/blockstore_db.rs | 1 - ledger/src/snapshot_utils.rs | 1 - net-utils/src/ip_echo_server.rs | 10 ++---- programs/btc_spv/src/spv_processor.rs | 1 - programs/btc_spv_bin/src/block.rs | 3 -- programs/btc_spv_bin/src/blockheade.rs | 2 -- sdk/src/signers.rs | 44 +++++++++++++------------- transaction-status/src/lib.rs | 1 - upload-perf/src/upload-perf.rs | 1 - 15 files changed, 24 insertions(+), 48 deletions(-) diff --git a/archiver-lib/src/result.rs b/archiver-lib/src/result.rs index cb7228de6a..813dd4d4a6 100644 --- a/archiver-lib/src/result.rs +++ b/archiver-lib/src/result.rs @@ -1,4 +1,3 @@ -use serde_json; use solana_client::client_error; use solana_ledger::blockstore; use solana_sdk::transport; diff --git a/core/src/crds_gossip_pull.rs b/core/src/crds_gossip_pull.rs index 2d985606d0..3958c8fdc3 100644 --- a/core/src/crds_gossip_pull.rs +++ b/core/src/crds_gossip_pull.rs @@ -14,7 +14,6 @@ use crate::crds::Crds; use crate::crds_gossip::{get_stake, get_weight, CRDS_GOSSIP_DEFAULT_BLOOM_ITEMS}; use crate::crds_gossip_error::CrdsGossipError; use crate::crds_value::{CrdsValue, CrdsValueLabel}; -use rand; use rand::distributions::{Distribution, WeightedIndex}; use rand::Rng; use solana_runtime::bloom::Bloom; diff --git a/core/src/poh_service.rs b/core/src/poh_service.rs index 8e516585a1..76f322cb1a 100644 --- a/core/src/poh_service.rs +++ b/core/src/poh_service.rs @@ -1,10 +1,8 @@ //! The `poh_service` module implements a service that records the passing of //! "ticks", a measure of time in the PoH stream use crate::poh_recorder::PohRecorder; -use core_affinity; use solana_sdk::clock::DEFAULT_TICKS_PER_SLOT; use solana_sdk::poh_config::PohConfig; -use solana_sys_tuner; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex}; use std::thread::{self, sleep, Builder, JoinHandle}; diff --git a/install/src/main-install-init.rs b/install/src/main-install-init.rs index bf06445730..42f68b1cdf 100644 --- a/install/src/main-install-init.rs +++ b/install/src/main-install-init.rs @@ -1,4 +1,3 @@ -use atty; use std::process::exit; fn press_enter() { diff --git a/keygen/src/keygen.rs b/keygen/src/keygen.rs index 358a37abab..697b5ba1ec 100644 --- a/keygen/src/keygen.rs +++ b/keygen/src/keygen.rs @@ -1,10 +1,8 @@ use bip39::{Language, Mnemonic, MnemonicType, Seed}; -use bs58; use clap::{ crate_description, crate_name, value_t, values_t_or_exit, App, AppSettings, Arg, ArgMatches, SubCommand, }; -use num_cpus; use solana_clap_utils::{ keypair::{ keypair_from_seed_phrase, prompt_passphrase, signer_from_path, diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 450945f7b4..3018539df7 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -2,7 +2,6 @@ use clap::{ crate_description, crate_name, value_t, value_t_or_exit, values_t_or_exit, App, Arg, ArgMatches, SubCommand, }; -use histogram; use serde_json::json; use solana_clap_utils::input_validators::is_slot; use solana_ledger::bank_forks::CompressionType; diff --git a/ledger/src/blockstore_db.rs b/ledger/src/blockstore_db.rs index 6d2f191c78..ae94c722f3 100644 --- a/ledger/src/blockstore_db.rs +++ b/ledger/src/blockstore_db.rs @@ -1,7 +1,6 @@ use crate::blockstore_meta; use bincode::{deserialize, serialize}; use byteorder::{BigEndian, ByteOrder}; -use fs_extra; use log::*; pub use rocksdb::Direction as IteratorDirection; use rocksdb::{ diff --git a/ledger/src/snapshot_utils.rs b/ledger/src/snapshot_utils.rs index ba930e5bda..59709df853 100644 --- a/ledger/src/snapshot_utils.rs +++ b/ledger/src/snapshot_utils.rs @@ -26,7 +26,6 @@ use std::{ use tar::Archive; use tempfile::TempDir; use thiserror::Error; -use zstd; pub const SNAPSHOT_STATUS_CACHE_FILE_NAME: &str = "status_cache"; pub const TAR_SNAPSHOTS_DIR: &str = "snapshots"; diff --git a/net-utils/src/ip_echo_server.rs b/net-utils/src/ip_echo_server.rs index 6355ccf03a..07f904ff14 100644 --- a/net-utils/src/ip_echo_server.rs +++ b/net-utils/src/ip_echo_server.rs @@ -1,14 +1,8 @@ use bytes::Bytes; use log::*; use serde_derive::{Deserialize, Serialize}; -use std::io; -use std::net::SocketAddr; -use std::time::Duration; -use tokio; -use tokio::net::TcpListener; -use tokio::prelude::*; -use tokio::reactor::Handle; -use tokio::runtime::Runtime; +use std::{io, net::SocketAddr, time::Duration}; +use tokio::{net::TcpListener, prelude::*, reactor::Handle, runtime::Runtime}; use tokio_codec::{BytesCodec, Decoder}; pub type IpEchoServer = Runtime; diff --git a/programs/btc_spv/src/spv_processor.rs b/programs/btc_spv/src/spv_processor.rs index ea805a5420..4b4cd9ad54 100644 --- a/programs/btc_spv/src/spv_processor.rs +++ b/programs/btc_spv/src/spv_processor.rs @@ -4,7 +4,6 @@ use crate::spv_instruction::*; use crate::spv_state::*; #[allow(unused_imports)] use crate::utils::*; -use hex; use log::*; use solana_sdk::account::KeyedAccount; use solana_sdk::instruction::InstructionError; diff --git a/programs/btc_spv_bin/src/block.rs b/programs/btc_spv_bin/src/block.rs index 5abf4674df..ac84531d41 100644 --- a/programs/btc_spv_bin/src/block.rs +++ b/programs/btc_spv_bin/src/block.rs @@ -1,7 +1,4 @@ -use clap; use clap::{App, Arg}; -use hex; -use reqwest; use std::fs::File; use std::io::prelude::*; diff --git a/programs/btc_spv_bin/src/blockheade.rs b/programs/btc_spv_bin/src/blockheade.rs index aa53bd3b7a..ce8fcaf715 100644 --- a/programs/btc_spv_bin/src/blockheade.rs +++ b/programs/btc_spv_bin/src/blockheade.rs @@ -1,6 +1,4 @@ -use clap; use clap::{App, Arg}; -use reqwest; use serde_derive::Deserialize; // pub type blockHash = [u8; 32]; diff --git a/sdk/src/signers.rs b/sdk/src/signers.rs index 8d8997b814..91323c2863 100644 --- a/sdk/src/signers.rs +++ b/sdk/src/signers.rs @@ -11,33 +11,33 @@ pub trait Signers { } macro_rules! default_keypairs_impl { - () => ( - fn pubkeys(&self) -> Vec { - self.iter().map(|keypair| keypair.pubkey()).collect() - } + () => { + fn pubkeys(&self) -> Vec { + self.iter().map(|keypair| keypair.pubkey()).collect() + } - fn try_pubkeys(&self) -> Result, SignerError> { - let mut pubkeys = Vec::new(); - for keypair in self.iter() { - pubkeys.push(keypair.try_pubkey()?); - } - Ok(pubkeys) + fn try_pubkeys(&self) -> Result, SignerError> { + let mut pubkeys = Vec::new(); + for keypair in self.iter() { + pubkeys.push(keypair.try_pubkey()?); } + Ok(pubkeys) + } - fn sign_message(&self, message: &[u8]) -> Vec { - self.iter() - .map(|keypair| keypair.sign_message(message)) - .collect() - } + fn sign_message(&self, message: &[u8]) -> Vec { + self.iter() + .map(|keypair| keypair.sign_message(message)) + .collect() + } - fn try_sign_message(&self, message: &[u8]) -> Result, SignerError> { - let mut signatures = Vec::new(); - for keypair in self.iter() { - signatures.push(keypair.try_sign_message(message)?); - } - Ok(signatures) + fn try_sign_message(&self, message: &[u8]) -> Result, SignerError> { + let mut signatures = Vec::new(); + for keypair in self.iter() { + signatures.push(keypair.try_sign_message(message)?); } - ); + Ok(signatures) + } + }; } impl Signers for [&T] { diff --git a/transaction-status/src/lib.rs b/transaction-status/src/lib.rs index 5ff0dde867..fb42d20748 100644 --- a/transaction-status/src/lib.rs +++ b/transaction-status/src/lib.rs @@ -1,7 +1,6 @@ #[macro_use] extern crate serde_derive; -use bincode; use solana_sdk::{ clock::Slot, commitment_config::CommitmentConfig, diff --git a/upload-perf/src/upload-perf.rs b/upload-perf/src/upload-perf.rs index 755fe23730..34436be80f 100644 --- a/upload-perf/src/upload-perf.rs +++ b/upload-perf/src/upload-perf.rs @@ -1,4 +1,3 @@ -use serde_json; use serde_json::Value; use std::collections::HashMap; use std::env;