mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
Fix new clippy lints (#2036)
## Issue Addressed NA ## Proposed Changes Fixes new clippy lints in the whole project (mainly [manual_strip](https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip) and [unnecessary_lazy_evaluations](https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations)). Furthermore, removes `to_string()` calls on literals when used with the `?`-operator.
This commit is contained in:
@@ -884,7 +884,7 @@ impl<T: EthSpec> BeaconState<T> {
|
||||
self.eth1_data
|
||||
.deposit_count
|
||||
.checked_sub(self.eth1_deposit_index)
|
||||
.ok_or_else(|| Error::InvalidDepositState {
|
||||
.ok_or(Error::InvalidDepositState {
|
||||
deposit_count: self.eth1_data.deposit_count,
|
||||
deposit_index: self.eth1_deposit_index,
|
||||
})
|
||||
|
||||
@@ -56,7 +56,7 @@ impl CommitteeCache {
|
||||
&seed[..],
|
||||
false,
|
||||
)
|
||||
.ok_or_else(|| Error::UnableToShuffle)?;
|
||||
.ok_or(Error::UnableToShuffle)?;
|
||||
|
||||
// The use of `NonZeroUsize` reduces the maximum number of possible validators by one.
|
||||
if state.validators.len() == usize::max_value() {
|
||||
@@ -148,7 +148,7 @@ impl CommitteeCache {
|
||||
pub fn get_all_beacon_committees(&self) -> Result<Vec<BeaconCommittee>, Error> {
|
||||
let initialized_epoch = self
|
||||
.initialized_epoch
|
||||
.ok_or_else(|| Error::CommitteeCacheUninitialized(None))?;
|
||||
.ok_or(Error::CommitteeCacheUninitialized(None))?;
|
||||
|
||||
initialized_epoch.slot_iter(self.slots_per_epoch).try_fold(
|
||||
Vec::with_capacity(self.slots_per_epoch as usize),
|
||||
|
||||
@@ -419,7 +419,7 @@ impl ParallelValidatorTreeHash {
|
||||
|
||||
let validator = validators
|
||||
.get(val_index)
|
||||
.ok_or_else(|| Error::TreeHashCacheInconsistent)?;
|
||||
.ok_or(Error::TreeHashCacheInconsistent)?;
|
||||
|
||||
validator
|
||||
.recalculate_tree_hash_root(arena, cache)
|
||||
|
||||
Reference in New Issue
Block a user