Clippy lints for rust 1.66 (#3810)

## Issue Addressed
Fixes the new clippy lints for rust 1.66

## Proposed Changes

Most of the changes come from:
- [unnecessary_cast](https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast)
- [iter_kv_map](https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map)
- [needless_borrow](https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow)

## Additional Info

na
This commit is contained in:
Divma
2022-12-16 04:04:00 +00:00
parent 63c74b37f4
commit ffbf70e2d9
31 changed files with 58 additions and 82 deletions

View File

@@ -482,7 +482,7 @@ impl<T: EthSpec> BeaconState<T> {
/// Spec v0.12.1
pub fn get_committee_count_at_slot(&self, slot: Slot) -> Result<u64, Error> {
let cache = self.committee_cache_at_slot(slot)?;
Ok(cache.committees_per_slot() as u64)
Ok(cache.committees_per_slot())
}
/// Compute the number of committees in an entire epoch.

View File

@@ -144,7 +144,7 @@ impl CommitteeCache {
self.committees_per_slot as usize,
index as usize,
);
let committee = self.compute_committee(committee_index as usize)?;
let committee = self.compute_committee(committee_index)?;
Some(BeaconCommittee {
slot,

View File

@@ -344,12 +344,7 @@ mod committees {
let cache_epoch = cache_epoch.into_epoch(state_epoch);
execute_committee_consistency_test(
new_head_state,
cache_epoch,
validator_count as usize,
spec,
);
execute_committee_consistency_test(new_head_state, cache_epoch, validator_count, spec);
}
async fn committee_consistency_test_suite<T: EthSpec>(cached_epoch: RelativeEpoch) {
@@ -361,18 +356,13 @@ mod committees {
.mul(spec.target_committee_size)
.add(1);
committee_consistency_test::<T>(validator_count as usize, Epoch::new(0), cached_epoch)
committee_consistency_test::<T>(validator_count, Epoch::new(0), cached_epoch).await;
committee_consistency_test::<T>(validator_count, T::genesis_epoch() + 4, cached_epoch)
.await;
committee_consistency_test::<T>(
validator_count as usize,
T::genesis_epoch() + 4,
cached_epoch,
)
.await;
committee_consistency_test::<T>(
validator_count as usize,
validator_count,
T::genesis_epoch()
+ (T::slots_per_historical_root() as u64)
.mul(T::slots_per_epoch())

View File

@@ -202,7 +202,7 @@ mod test {
}
fn preset_from_file<T: DeserializeOwned>(preset_name: &str, filename: &str) -> T {
let f = File::open(&presets_base_path().join(preset_name).join(filename))
let f = File::open(presets_base_path().join(preset_name).join(filename))
.expect("preset file exists");
serde_yaml::from_reader(f).unwrap()
}