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

@@ -441,7 +441,7 @@ impl DoppelgangerService {
}
// Get a list of indices to provide to the BN API.
let indices_only = indices_map.iter().map(|(index, _)| *index).collect();
let indices_only = indices_map.keys().copied().collect();
// Pull the liveness responses from the BN.
let request_epoch = request_slot.epoch(E::slots_per_epoch());
@@ -971,16 +971,16 @@ mod test {
LivenessResponses {
current_epoch_responses: detection_indices
.iter()
.map(|i| LivenessResponseData {
index: *i as u64,
.map(|&index| LivenessResponseData {
index,
epoch: current_epoch,
is_live: false,
})
.collect(),
previous_epoch_responses: detection_indices
.iter()
.map(|i| LivenessResponseData {
index: *i as u64,
.map(|&index| LivenessResponseData {
index,
epoch: current_epoch - 1,
is_live: false,
})

View File

@@ -331,7 +331,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
.and(signer.clone())
.and_then(|sysinfo, app_start: std::time::Instant, val_dir, signer| {
blocking_signed_json_task(signer, move || {
let app_uptime = app_start.elapsed().as_secs() as u64;
let app_uptime = app_start.elapsed().as_secs();
Ok(api_types::GenericResponse::from(observe_system_health_vc(
sysinfo, val_dir, app_uptime,
)))

View File

@@ -472,7 +472,7 @@ impl InitializedValidators {
/// Iterate through all voting public keys in `self` that should be used when querying for duties.
pub fn iter_voting_pubkeys(&self) -> impl Iterator<Item = &PublicKeyBytes> {
self.validators.iter().map(|(pubkey, _)| pubkey)
self.validators.keys()
}
/// Returns the voting `Keypair` for a given voting `PublicKey`, if all are true:

View File

@@ -104,7 +104,7 @@ impl KeyCache {
let file = File::options()
.read(true)
.create_new(false)
.open(&cache_path)
.open(cache_path)
.map_err(Error::UnableToOpenFile)?;
serde_json::from_reader(file).map_err(Error::UnableToParseFile)
}