mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
Fix clippy warnings (#1385)
## Issue Addressed NA ## Proposed Changes Fixes most clippy warnings and ignores the rest of them, see issue #1388.
This commit is contained in:
@@ -190,7 +190,7 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
|
||||
.into_iter()
|
||||
.fold(HashMap::new(), |mut map, duty_and_proof| {
|
||||
if let Some(committee_index) = duty_and_proof.duty.attestation_committee_index {
|
||||
let validator_duties = map.entry(committee_index).or_insert_with(|| vec![]);
|
||||
let validator_duties = map.entry(committee_index).or_insert_with(Vec::new);
|
||||
|
||||
validator_duties.push(duty_and_proof);
|
||||
}
|
||||
|
||||
@@ -151,9 +151,9 @@ enum InsertOutcome {
|
||||
|
||||
impl InsertOutcome {
|
||||
/// Returns `true` if the outcome indicates that the validator _might_ require a subscription.
|
||||
pub fn is_subscription_candidate(self) -> bool {
|
||||
pub fn is_subscription_candidate(&self) -> bool {
|
||||
match self {
|
||||
InsertOutcome::Replaced { should_resubscribe } => should_resubscribe,
|
||||
InsertOutcome::Replaced { should_resubscribe } => *should_resubscribe,
|
||||
InsertOutcome::NewValidator | InsertOutcome::NewEpoch => true,
|
||||
InsertOutcome::Identical | InsertOutcome::Invalid | InsertOutcome::NewProposalSlots => {
|
||||
false
|
||||
|
||||
@@ -95,7 +95,7 @@ impl<T, E: EthSpec> Deref for ForkService<T, E> {
|
||||
impl<T: SlotClock + 'static, E: EthSpec> ForkService<T, E> {
|
||||
/// Returns the last fork downloaded from the beacon node, if any.
|
||||
pub fn fork(&self) -> Option<Fork> {
|
||||
self.fork.read().clone()
|
||||
*self.fork.read()
|
||||
}
|
||||
|
||||
/// Starts the service that periodically polls for the `Fork`.
|
||||
|
||||
@@ -345,11 +345,14 @@ impl InitializedValidators {
|
||||
voting_public_key: &PublicKey,
|
||||
enabled: bool,
|
||||
) -> Result<(), Error> {
|
||||
self.definitions
|
||||
if let Some(def) = self
|
||||
.definitions
|
||||
.as_mut_slice()
|
||||
.iter_mut()
|
||||
.find(|def| def.voting_public_key == *voting_public_key)
|
||||
.map(|def| def.enabled = enabled);
|
||||
{
|
||||
def.enabled = enabled;
|
||||
}
|
||||
|
||||
self.update_validators()?;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
use account_utils::{create_with_600_perms, default_keystore_password_path, ZeroizeString};
|
||||
use eth2_keystore::Keystore;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use serde_yaml;
|
||||
use slog::{error, Logger};
|
||||
use std::collections::HashSet;
|
||||
use std::fs::{self, OpenOptions};
|
||||
@@ -230,14 +229,13 @@ pub fn recursively_find_voting_keystores<P: AsRef<Path>>(
|
||||
let file_type = dir_entry.file_type()?;
|
||||
if file_type.is_dir() {
|
||||
recursively_find_voting_keystores(dir_entry.path(), matches)?
|
||||
} else if file_type.is_file() {
|
||||
if dir_entry
|
||||
} else if file_type.is_file()
|
||||
&& dir_entry
|
||||
.file_name()
|
||||
.to_str()
|
||||
.map_or(false, |filename| filename == VOTING_KEYSTORE_FILE)
|
||||
{
|
||||
matches.push(dir_entry.path())
|
||||
}
|
||||
{
|
||||
matches.push(dir_entry.path())
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user