Clippy clean (#536)

* Change into_iter to iter

* Fix clippy 'easy' warnings

* Clippy eth2/utils

* Add struct NetworkInfo

* Clippy for types, utils, and beacon_node/store/src/iters.rs

* Cargo fmt

* Change foo to my_foo

* Remove complex signature

* suppress clippy warning for unit_value in benches

* Use enumerate instead of iterating over range

* Allow trivially_copy_pass_by_ref in serde_utils
This commit is contained in:
pscott
2019-09-30 05:58:45 +02:00
committed by Paul Hauner
parent 682b11f248
commit 7eb82125ef
39 changed files with 118 additions and 121 deletions

View File

@@ -73,7 +73,6 @@ fn shuffles_for_the_right_epoch() {
let spec = &MinimalEthSpec::default_spec();
let distinct_hashes: Vec<Hash256> = (0..MinimalEthSpec::epochs_per_historical_vector())
.into_iter()
.map(|i| Hash256::from_low_u64_be(i as u64))
.collect();

View File

@@ -192,7 +192,7 @@ fn tree_hash_cache() {
assert_eq!(root.as_bytes(), &state.tree_hash_root()[..]);
state.slot = state.slot + 1;
state.slot += 1;
let root = state.update_tree_hash_cache().unwrap();
assert_eq!(root.as_bytes(), &state.tree_hash_root()[..]);
@@ -231,9 +231,8 @@ mod committees {
shuffle_list(active_indices, spec.shuffle_round_count, &seed[..], false).unwrap();
let mut expected_indices_iter = shuffling.iter();
let mut expected_shards_iter = (0..T::ShardCount::to_u64())
.into_iter()
.map(|i| (start_shard + i) % T::ShardCount::to_u64());
let mut expected_shards_iter =
(0..T::ShardCount::to_u64()).map(|i| (start_shard + i) % T::ShardCount::to_u64());
// Loop through all slots in the epoch being tested.
for slot in epoch.slot_iter(T::slots_per_epoch()) {
@@ -306,7 +305,6 @@ mod committees {
let (mut state, _keypairs): (BeaconState<T>, _) = builder.build();
let distinct_hashes: Vec<Hash256> = (0..T::epochs_per_historical_vector())
.into_iter()
.map(|i| Hash256::from_low_u64_be(i as u64))
.collect();
state.randao_mixes = FixedVector::from(distinct_hashes);

View File

@@ -123,7 +123,7 @@ impl<T: EthSpec> TestingBeaconStateBuilder<T> {
.collect::<Vec<_>>()
.into();
let genesis_time = 1567052589; // 29 August, 2019;
let genesis_time = 1_567_052_589; // 29 August, 2019;
let mut state = BeaconState::new(
genesis_time,

View File

@@ -46,6 +46,7 @@ where
Ok(array)
}
#[allow(clippy::trivially_copy_pass_by_ref)]
pub fn fork_to_hex_str<S>(bytes: &[u8; FORK_BYTES_LEN], serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,