Fix clippy warnings (#813)

* Clippy account manager

* Clippy account_manager

* Clippy beacon_node/beacon_chain

* Clippy beacon_node/client

* Clippy beacon_node/eth1

* Clippy beacon_node/eth2-libp2p

* Clippy beacon_node/genesis

* Clippy beacon_node/network

* Clippy beacon_node/rest_api

* Clippy beacon_node/src

* Clippy beacon_node/store

* Clippy eth2/lmd_ghost

* Clippy eth2/operation_pool

* Clippy eth2/state_processing

* Clippy eth2/types

* Clippy eth2/utils/bls

* Clippy eth2/utils/cahced_tree_hash

* Clippy eth2/utils/deposit_contract

* Clippy eth2/utils/eth2_interop_keypairs

* Clippy eth2/utils/eth2_testnet_config

* Clippy eth2/utils/lighthouse_metrics

* Clippy eth2/utils/ssz

* Clippy eth2/utils/ssz_types

* Clippy eth2/utils/tree_hash_derive

* Clippy lcli

* Clippy tests/beacon_chain_sim

* Clippy validator_client

* Cargo fmt
This commit is contained in:
pscott
2020-01-21 11:38:56 +04:00
committed by Age Manning
parent 1abb964652
commit 7396cd2cab
78 changed files with 387 additions and 416 deletions

View File

@@ -3,6 +3,7 @@ use eth2_libp2p::rpc::methods::*;
use eth2_libp2p::rpc::*;
use eth2_libp2p::{Libp2pEvent, RPCEvent};
use slog::{warn, Level};
use std::sync::atomic::{AtomicBool, Ordering::Relaxed};
use std::sync::{Arc, Mutex};
use std::time::Duration;
use tokio::prelude::*;
@@ -106,20 +107,19 @@ fn test_status_rpc() {
});
// execute the futures and check the result
let test_result = Arc::new(Mutex::new(false));
let test_result = Arc::new(AtomicBool::new(false));
let error_result = test_result.clone();
let thread_result = test_result.clone();
tokio::run(
sender_future
.select(receiver_future)
.timeout(Duration::from_millis(1000))
.map_err(move |_| *error_result.lock().unwrap() = false)
.map_err(move |_| error_result.store(false, Relaxed))
.map(move |result| {
*thread_result.lock().unwrap() = result.0;
()
thread_result.store(result.0, Relaxed);
}),
);
assert!(*test_result.lock().unwrap());
assert!(test_result.load(Relaxed));
}
#[test]
@@ -236,20 +236,19 @@ fn test_blocks_by_range_chunked_rpc() {
});
// execute the futures and check the result
let test_result = Arc::new(Mutex::new(false));
let test_result = Arc::new(AtomicBool::new(false));
let error_result = test_result.clone();
let thread_result = test_result.clone();
tokio::run(
sender_future
.select(receiver_future)
.timeout(Duration::from_millis(1000))
.map_err(move |_| *error_result.lock().unwrap() = false)
.map_err(move |_| error_result.store(false, Relaxed))
.map(move |result| {
*thread_result.lock().unwrap() = result.0;
()
thread_result.store(result.0, Relaxed);
}),
);
assert!(*test_result.lock().unwrap());
assert!(test_result.load(Relaxed));
}
#[test]
@@ -359,20 +358,19 @@ fn test_blocks_by_range_single_empty_rpc() {
});
// execute the futures and check the result
let test_result = Arc::new(Mutex::new(false));
let test_result = Arc::new(AtomicBool::new(false));
let error_result = test_result.clone();
let thread_result = test_result.clone();
tokio::run(
sender_future
.select(receiver_future)
.timeout(Duration::from_millis(1000))
.map_err(move |_| *error_result.lock().unwrap() = false)
.map_err(move |_| error_result.store(false, Relaxed))
.map(move |result| {
*thread_result.lock().unwrap() = result.0;
()
thread_result.store(result.0, Relaxed);
}),
);
assert!(*test_result.lock().unwrap());
assert!(test_result.load(Relaxed));
}
#[test]
@@ -486,20 +484,19 @@ fn test_blocks_by_root_chunked_rpc() {
});
// execute the futures and check the result
let test_result = Arc::new(Mutex::new(false));
let test_result = Arc::new(AtomicBool::new(false));
let error_result = test_result.clone();
let thread_result = test_result.clone();
tokio::run(
sender_future
.select(receiver_future)
.timeout(Duration::from_millis(1000))
.map_err(move |_| *error_result.lock().unwrap() = false)
.map_err(move |_| error_result.store(false, Relaxed))
.map(move |result| {
*thread_result.lock().unwrap() = result.0;
()
thread_result.store(result.0, Relaxed);
}),
);
assert!(*test_result.lock().unwrap());
assert!(test_result.load(Relaxed));
}
#[test]
@@ -558,18 +555,17 @@ fn test_goodbye_rpc() {
});
// execute the futures and check the result
let test_result = Arc::new(Mutex::new(false));
let test_result = Arc::new(AtomicBool::new(false));
let error_result = test_result.clone();
let thread_result = test_result.clone();
tokio::run(
sender_future
.select(receiver_future)
.timeout(Duration::from_millis(1000))
.map_err(move |_| *error_result.lock().unwrap() = false)
.map_err(move |_| error_result.store(false, Relaxed))
.map(move |result| {
*thread_result.lock().unwrap() = result.0;
()
thread_result.store(result.0, Relaxed);
}),
);
assert!(*test_result.lock().unwrap());
assert!(test_result.load(Relaxed));
}