Cleanup compiler warnings (#2323)

* cleanup compiler warnings
* allow(dead_code) in tests/{framework,simulnet}
This commit is contained in:
Simon B 2019-01-10 21:18:25 +01:00 committed by Ignotus Peverell
parent 27b4e2145a
commit 950fa0e496
5 changed files with 23 additions and 11 deletions

View file

@ -16,7 +16,7 @@ use self::chain::types::NoopAdapter;
use self::chain::Chain;
use self::core::core::hash::Hashed;
use self::core::core::verifier_cache::LruVerifierCache;
use self::core::core::{Block, BlockHeader, OutputFeatures, OutputIdentifier, Transaction};
use self::core::core::{Block, BlockHeader, OutputIdentifier, Transaction};
use self::core::genesis;
use self::core::global::ChainTypes;
use self::core::libtx::{self, build, reward};

View file

@ -14,17 +14,16 @@
//! Common test functions
use crate::core::core::{
use crate::keychain::{Identifier, Keychain};
use grin_core::core::{
block::{Block, BlockHeader},
Transaction,
};
use crate::core::libtx::{
use grin_core::libtx::{
build::{self, input, output, with_fee},
reward,
};
use crate::core::pow::Difficulty;
use crate::keychain::{Identifier, Keychain};
use grin_core as core;
use grin_core::pow::Difficulty;
use grin_keychain as keychain;
// utility producing a transaction with 2 inputs and a single outputs

View file

@ -14,9 +14,7 @@
use self::keychain::Keychain;
use self::util::Mutex;
use self::wallet::{
HTTPNodeClient, HTTPWalletCommAdapter, LMDBBackend, WalletCommAdapter, WalletConfig,
};
use self::wallet::{HTTPNodeClient, HTTPWalletCommAdapter, LMDBBackend, WalletConfig};
use blake2_rfc as blake2;
use grin_api as api;
use grin_core as core;
@ -127,6 +125,7 @@ impl Default for LocalServerContainerConfig {
/// A top-level container to hold everything that might be running
/// on a server, i.e. server, wallet in send or receive mode
#[allow(dead_code)]
pub struct LocalServerContainer {
// Configuration
config: LocalServerContainerConfig,
@ -307,6 +306,7 @@ impl LocalServerContainer {
}
/// Starts a wallet owner daemon
#[allow(dead_code)]
pub fn run_owner(&mut self) {
let wallet = self.make_wallet_for_tests();
@ -329,6 +329,7 @@ impl LocalServerContainer {
});
}
#[allow(dead_code)]
pub fn get_wallet_seed(config: &WalletConfig) -> wallet::WalletSeed {
let _ = fs::create_dir_all(config.clone().data_file_dir);
wallet::WalletSeed::init_file(config, 32, None, "").unwrap();
@ -337,6 +338,7 @@ impl LocalServerContainer {
wallet_seed
}
#[allow(dead_code)]
pub fn get_wallet_info(
config: &WalletConfig,
wallet_seed: &wallet::WalletSeed,
@ -354,6 +356,7 @@ impl LocalServerContainer {
wallet::libwallet::internal::updater::retrieve_info(&mut wallet, &parent_id, 1).unwrap()
}
#[allow(dead_code)]
pub fn send_amount_to(
config: &WalletConfig,
amount: &str,
@ -414,6 +417,7 @@ impl LocalServerContainer {
/// Adds a peer to this server to connect to upon running
#[allow(dead_code)]
pub fn add_peer(&mut self, addr: String) {
self.peer_list.push(addr);
}
@ -467,6 +471,7 @@ impl Default for LocalServerContainerPoolConfig {
/// A convenience pool for running many servers simultaneously
/// without necessarily having to configure each one manually
#[allow(dead_code)]
pub struct LocalServerContainerPool {
// configuration
pub config: LocalServerContainerPoolConfig,
@ -487,6 +492,7 @@ pub struct LocalServerContainerPool {
is_seeding: bool,
}
#[allow(dead_code)]
impl LocalServerContainerPool {
pub fn new(config: LocalServerContainerPoolConfig) -> LocalServerContainerPool {
(LocalServerContainerPool {
@ -506,6 +512,7 @@ impl LocalServerContainerPool {
/// ports/addresses filled in
///
#[allow(dead_code)]
pub fn create_server(&mut self, server_config: &mut LocalServerContainerConfig) {
// If we're calling it this way, need to override these
server_config.p2p_server_port = self.next_p2p_port;
@ -562,6 +569,7 @@ impl LocalServerContainerPool {
/// once they've all been run
///
#[allow(dead_code)]
pub fn run_all_servers(self) -> Arc<Mutex<Vec<servers::Server>>> {
let run_length = self.config.run_length_in_seconds;
let mut handles = vec![];
@ -603,6 +611,7 @@ impl LocalServerContainerPool {
return_containers.clone()
}
#[allow(dead_code)]
pub fn connect_all_peers(&mut self) {
// just pull out all currently active servers, build a list,
// and feed into all servers
@ -622,6 +631,7 @@ impl LocalServerContainerPool {
}
}
#[allow(dead_code)]
pub fn stop_all_servers(servers: Arc<Mutex<Vec<servers::Server>>>) {
let locked_servs = servers.lock();
for s in locked_servs.deref() {
@ -630,6 +640,7 @@ pub fn stop_all_servers(servers: Arc<Mutex<Vec<servers::Server>>>) {
}
/// Create and return a ServerConfig
#[allow(dead_code)]
pub fn config(n: u16, test_name_dir: &str, seed_n: u16) -> servers::ServerConfig {
servers::ServerConfig {
api_http_addr: format!("127.0.0.1:{}", 20000 + n),
@ -649,6 +660,7 @@ pub fn config(n: u16, test_name_dir: &str, seed_n: u16) -> servers::ServerConfig
}
/// return stratum mining config
#[allow(dead_code)]
pub fn stratum_config() -> servers::common::types::StratumServerConfig {
servers::common::types::StratumServerConfig {
enable_stratum_server: Some(true),

View file

@ -24,7 +24,7 @@ use self::wallet::controller;
use self::wallet::libwallet::types::{WalletBackend, WalletInst};
use self::wallet::lmdb_wallet::LMDBBackend;
use self::wallet::WalletConfig;
use self::wallet::{HTTPNodeClient, HTTPWalletCommAdapter, WalletCommAdapter};
use self::wallet::{HTTPNodeClient, HTTPWalletCommAdapter};
use grin_api as api;
use grin_core as core;
use grin_keychain as keychain;
@ -826,6 +826,7 @@ fn long_fork_test_case_5(s: &Vec<servers::Server>) {
println!("test case 5 passed")
}
#[allow(dead_code)]
fn long_fork_test_case_6(s: &Vec<servers::Server>) {
println!("\ntest case 6 start");

View file

@ -822,7 +822,7 @@ fn create_numbered_files(
start_index + rewind_file_num
));
let file = fs::File::create(path.clone()).unwrap();
let metadata = file.metadata().unwrap();
let _metadata = file.metadata().unwrap();
filetime::set_file_times(path, time_to_set_ft, time_to_set_ft).unwrap();
}
}