mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
Add various fixes to clippy lints
Thou shalt appease clippy
This commit is contained in:
@@ -422,7 +422,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
};
|
||||
let effective_balance = self.validator_registry[candidate_index].effective_balance;
|
||||
if (effective_balance * MAX_RANDOM_BYTE)
|
||||
>= (spec.max_effective_balance * random_byte as u64)
|
||||
>= (spec.max_effective_balance * u64::from(random_byte))
|
||||
{
|
||||
break candidate_index;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,6 @@ impl CommitteeCache {
|
||||
let i = self.shuffled_position(validator_index)?;
|
||||
|
||||
(0..self.committee_count)
|
||||
.into_iter()
|
||||
.map(|nth_committee| (nth_committee, self.compute_committee_range(nth_committee)))
|
||||
.find(|(_, range)| {
|
||||
if let Some(range) = range {
|
||||
|
||||
@@ -174,7 +174,7 @@ impl ChainSpec {
|
||||
/*
|
||||
* Time parameters
|
||||
*/
|
||||
genesis_time: u32::max_value() as u64,
|
||||
genesis_time: u64::from(u32::max_value()),
|
||||
seconds_per_slot: 6,
|
||||
min_attestation_inclusion_delay: 4,
|
||||
min_seed_lookahead: Epoch::new(1),
|
||||
|
||||
@@ -77,7 +77,7 @@ impl Epoch {
|
||||
/// Position of some slot inside an epoch, if any.
|
||||
///
|
||||
/// E.g., the first `slot` in `epoch` is at position `0`.
|
||||
pub fn position(&self, slot: Slot, slots_per_epoch: u64) -> Option<usize> {
|
||||
pub fn position(self, slot: Slot, slots_per_epoch: u64) -> Option<usize> {
|
||||
let start = self.start_slot(slots_per_epoch);
|
||||
let end = self.end_slot(slots_per_epoch);
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ fn build_proposer_slashing<T: EthSpec>(
|
||||
Signature::new(message, domain, secret_key)
|
||||
};
|
||||
|
||||
TestingProposerSlashingBuilder::double_vote::<T, _>(validator_index, signer, spec)
|
||||
TestingProposerSlashingBuilder::double_vote::<T, _>(validator_index, signer)
|
||||
}
|
||||
|
||||
/// Builds an `AttesterSlashing` for some `validator_indices`.
|
||||
|
||||
@@ -17,7 +17,7 @@ impl TestingProposerSlashingBuilder {
|
||||
/// - `domain: Domain`
|
||||
///
|
||||
/// Where domain is a domain "constant" (e.g., `spec.domain_attestation`).
|
||||
pub fn double_vote<T, F>(proposer_index: u64, signer: F, spec: &ChainSpec) -> ProposerSlashing
|
||||
pub fn double_vote<T, F>(proposer_index: u64, signer: F) -> ProposerSlashing
|
||||
where
|
||||
T: EthSpec,
|
||||
F: Fn(u64, &[u8], Epoch, Domain) -> Signature,
|
||||
|
||||
@@ -13,6 +13,7 @@ where
|
||||
u8::from_str_radix(&s.as_str()[2..], 16).map_err(D::Error::custom)
|
||||
}
|
||||
|
||||
#[allow(clippy::trivially_copy_pass_by_ref)] // Serde requires the `byte` to be a ref.
|
||||
pub fn u8_to_hex_str<S>(byte: &u8, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
|
||||
Reference in New Issue
Block a user