Fix clippy lints

This commit is contained in:
Paul Hauner
2019-01-04 18:30:24 +11:00
parent 62640ad691
commit 3876e29f6e
9 changed files with 25 additions and 18 deletions

View File

@@ -8,7 +8,7 @@ pub fn genesis_beacon_block(state_root: Hash256, spec: &ChainSpec) -> BeaconBloc
BeaconBlock {
slot: spec.initial_slot_number,
parent_root: spec.zero_hash,
state_root: state_root,
state_root,
randao_reveal: spec.zero_hash,
candidate_pow_receipt_root: spec.zero_hash,
signature: genesis_signature(),

View File

@@ -15,8 +15,8 @@ pub enum ForkChoiceError {
}
pub fn naive_fork_choice<T>(
head_block_hashes: &Vec<Hash256>,
block_store: Arc<BeaconBlockStore<T>>,
head_block_hashes: &[Hash256],
block_store: &Arc<BeaconBlockStore<T>>,
) -> Result<Option<usize>, ForkChoiceError>
where
T: ClientDB + Sized,
@@ -28,7 +28,7 @@ where
*/
for (index, block_hash) in head_block_hashes.iter().enumerate() {
let ssz = block_store
.get(&block_hash.to_vec()[..])?
.get(&block_hash)?
.ok_or(ForkChoiceError::MissingBlock)?;
let (block, _) = BeaconBlock::ssz_decode(&ssz, 0)?;
head_blocks.push((index, block));

View File

@@ -64,7 +64,7 @@ impl ChainSpec {
* Intialization parameters
*/
initial_validators: initial_validators_for_testing(),
genesis_time: 1544672897,
genesis_time: 1_544_672_897,
processed_pow_receipt_root: Hash256::from("pow_root".as_bytes()),
}
}

View File

@@ -5,7 +5,7 @@ use rand::RngCore;
use ssz::{Decodable, DecodeError, Encodable, SszStream};
use std::convert;
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum ValidatorStatus {
PendingActivation,
Active,
@@ -87,7 +87,7 @@ impl<T: RngCore> TestRandom<T> for ValidatorStatus {
ValidatorStatus::Withdrawn,
ValidatorStatus::Penalized,
];
options[(rng.next_u32() as usize) % options.len()].clone()
options[(rng.next_u32() as usize) % options.len()]
}
}

View File

@@ -6,7 +6,7 @@ use bls_aggregates::AggregateSignature as RawAggregateSignature;
///
/// This struct is a wrapper upon a base type and provides helper functions (e.g., SSZ
/// serialization).
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Clone, Default)]
pub struct AggregateSignature(RawAggregateSignature);
impl AggregateSignature {

View File

@@ -26,7 +26,7 @@ impl SystemTimeSlotClock {
if slot_duration_seconds == 0 {
Err(Error::SlotDurationIsZero)
} else {
Ok(SystemTimeSlotClock {
Ok(Self {
genesis_seconds,
slot_duration_seconds,
})