Fix clippy warnings (#813)

* Clippy account manager

* Clippy account_manager

* Clippy beacon_node/beacon_chain

* Clippy beacon_node/client

* Clippy beacon_node/eth1

* Clippy beacon_node/eth2-libp2p

* Clippy beacon_node/genesis

* Clippy beacon_node/network

* Clippy beacon_node/rest_api

* Clippy beacon_node/src

* Clippy beacon_node/store

* Clippy eth2/lmd_ghost

* Clippy eth2/operation_pool

* Clippy eth2/state_processing

* Clippy eth2/types

* Clippy eth2/utils/bls

* Clippy eth2/utils/cahced_tree_hash

* Clippy eth2/utils/deposit_contract

* Clippy eth2/utils/eth2_interop_keypairs

* Clippy eth2/utils/eth2_testnet_config

* Clippy eth2/utils/lighthouse_metrics

* Clippy eth2/utils/ssz

* Clippy eth2/utils/ssz_types

* Clippy eth2/utils/tree_hash_derive

* Clippy lcli

* Clippy tests/beacon_chain_sim

* Clippy validator_client

* Cargo fmt
This commit is contained in:
pscott
2020-01-21 11:38:56 +04:00
committed by Age Manning
parent 1abb964652
commit 7396cd2cab
78 changed files with 387 additions and 416 deletions

View File

@@ -71,13 +71,13 @@ impl<T: EthSpec> Attestation<T> {
if self
.aggregation_bits
.get(committee_position)
.map_err(|e| Error::SszTypesError(e))?
.map_err(Error::SszTypesError)?
{
Err(Error::AlreadySigned(committee_position))
} else {
self.aggregation_bits
.set(committee_position, true)
.map_err(|e| Error::SszTypesError(e))?;
.map_err(Error::SszTypesError)?;
let message = self.data.tree_hash_root();
let domain = spec.get_domain(self.data.target.epoch, Domain::BeaconAttester, fork);

View File

@@ -897,7 +897,7 @@ impl<T: EthSpec> BeaconState<T> {
.enumerate()
.skip(self.pubkey_cache.len())
{
let success = self.pubkey_cache.insert(validator.pubkey.clone().into(), i);
let success = self.pubkey_cache.insert(validator.pubkey.clone(), i);
if !success {
return Err(Error::PubkeyCacheInconsistent);
}
@@ -957,7 +957,7 @@ impl<T: EthSpec> BeaconState<T> {
validator
.pubkey
.decompress()
.map_err(|e| Error::InvalidValidatorPubkey(e))
.map_err(Error::InvalidValidatorPubkey)
} else {
Ok(())
}

View File

@@ -24,9 +24,8 @@ impl<T: EthSpec> TestingAttestationBuilder<T> {
let mut aggregation_bits_len = committee.len();
match test_task {
AttestationTestTask::BadAggregationBitfieldLen => aggregation_bits_len += 1,
_ => (),
if test_task == AttestationTestTask::BadAggregationBitfieldLen {
aggregation_bits_len += 1
}
let mut aggregation_bits = BitList::with_capacity(aggregation_bits_len).unwrap();

View File

@@ -15,7 +15,7 @@ pub const KEYPAIRS_FILE: &str = "keypairs.raw_keypairs";
/// `./keypairs.raw_keypairs`.
pub fn keypairs_path() -> PathBuf {
let dir = dirs::home_dir()
.and_then(|home| Some(home.join(".lighthouse")))
.map(|home| (home.join(".lighthouse")))
.unwrap_or_else(|| PathBuf::from(""));
dir.join(KEYPAIRS_FILE)
}
@@ -42,7 +42,7 @@ impl<T: EthSpec> TestingBeaconStateBuilder<T> {
/// If the file does not contain enough keypairs or is invalid.
pub fn from_default_keypairs_file_if_exists(validator_count: usize, spec: &ChainSpec) -> Self {
let dir = dirs::home_dir()
.and_then(|home| Some(home.join(".lighthouse")))
.map(|home| home.join(".lighthouse"))
.unwrap_or_else(|| PathBuf::from(""));
let file = dir.join(KEYPAIRS_FILE);

View File

@@ -30,7 +30,7 @@ impl TestingProposerSlashingBuilder {
let slot = Slot::new(0);
let hash_1 = Hash256::from([1; 32]);
let hash_2 = if test_task == ProposerSlashingTestTask::ProposalsIdentical {
hash_1.clone()
hash_1
} else {
Hash256::from([2; 32])
};