Fix clippy errors on tests (#2160)

## Issue Addressed

There are some clippy error on tests.


## Proposed Changes

Enable clippy check on tests and fix the errors. 💪
This commit is contained in:
Akihito Nakano
2021-01-28 23:31:06 +00:00
parent e4b62139d7
commit 1a22a096c6
36 changed files with 513 additions and 516 deletions

View File

@@ -107,7 +107,7 @@ fn surrounds_existing_single_val_single_chunk() {
fn surrounds_existing_multi_vals_single_chunk() {
let validators = vec![0, 16, 1024, 300_000, 300_001];
let att1 = indexed_att(validators.clone(), 1, 2, 0);
let att2 = indexed_att(validators.clone(), 0, 3, 0);
let att2 = indexed_att(validators, 0, 3, 0);
let slashings = hashset![att_slashing(&att2, &att1)];
slasher_test_indiv(&[att1, att2], &slashings, 3);
}

View File

@@ -9,7 +9,7 @@ use types::{Epoch, EthSpec};
fn empty_pruning() {
let tempdir = tempdir().unwrap();
let config = Config::new(tempdir.path().into());
let slasher = Slasher::<E>::open(config.clone(), logger()).unwrap();
let slasher = Slasher::<E>::open(config, logger()).unwrap();
slasher.prune_database(Epoch::new(0)).unwrap();
}

View File

@@ -62,7 +62,7 @@ fn random_test(seed: u64, test_config: TestConfig) {
.choose_multiple(&mut rng, num_attesters)
.copied()
.collect::<Vec<u64>>();
attesting_indices.sort();
attesting_indices.sort_unstable();
// If checking slashings, generate valid attestations in range.
let (source, target) = if check_slashings {

View File

@@ -30,7 +30,7 @@ fn attestation_pruning_empty_wrap_around() {
// Add an attestation that would be surrounded with the modulo considered
slasher.accept_attestation(indexed_att(
v.clone(),
v,
2 * history_length - 3,
2 * history_length - 2,
1,
@@ -48,7 +48,7 @@ fn pruning_with_map_full() {
config.history_length = 1024;
config.max_db_size_mbs = 1;
let slasher = Slasher::open(config.clone(), logger()).unwrap();
let slasher = Slasher::open(config, logger()).unwrap();
let v = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];