mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Rust 1.84 lints (#6781)
* Fix few lints * Fix remaining lints * Use fully qualified syntax
This commit is contained in:
@@ -283,7 +283,7 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockBodyRef<'a, E,
|
||||
/// Return `true` if this block body has a non-zero number of blobs.
|
||||
pub fn has_blobs(self) -> bool {
|
||||
self.blob_kzg_commitments()
|
||||
.map_or(false, |blobs| !blobs.is_empty())
|
||||
.is_ok_and(|blobs| !blobs.is_empty())
|
||||
}
|
||||
|
||||
pub fn attestations_len(&self) -> usize {
|
||||
|
||||
@@ -1856,7 +1856,7 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
pub fn committee_cache_is_initialized(&self, relative_epoch: RelativeEpoch) -> bool {
|
||||
let i = Self::committee_cache_index(relative_epoch);
|
||||
|
||||
self.committee_cache_at_index(i).map_or(false, |cache| {
|
||||
self.committee_cache_at_index(i).is_ok_and(|cache| {
|
||||
cache.is_initialized_at(relative_epoch.into_epoch(self.current_epoch()))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ impl ProgressiveBalancesCache {
|
||||
pub fn is_initialized_at(&self, epoch: Epoch) -> bool {
|
||||
self.inner
|
||||
.as_ref()
|
||||
.map_or(false, |inner| inner.current_epoch == epoch)
|
||||
.is_some_and(|inner| inner.current_epoch == epoch)
|
||||
}
|
||||
|
||||
/// When a new target attestation has been processed, we update the cached
|
||||
|
||||
@@ -420,16 +420,14 @@ impl ChainSpec {
|
||||
|
||||
/// Returns true if the given epoch is greater than or equal to the `EIP7594_FORK_EPOCH`.
|
||||
pub fn is_peer_das_enabled_for_epoch(&self, block_epoch: Epoch) -> bool {
|
||||
self.eip7594_fork_epoch.map_or(false, |eip7594_fork_epoch| {
|
||||
block_epoch >= eip7594_fork_epoch
|
||||
})
|
||||
self.eip7594_fork_epoch
|
||||
.is_some_and(|eip7594_fork_epoch| block_epoch >= eip7594_fork_epoch)
|
||||
}
|
||||
|
||||
/// Returns true if `EIP7594_FORK_EPOCH` is set and is not set to `FAR_FUTURE_EPOCH`.
|
||||
pub fn is_peer_das_scheduled(&self) -> bool {
|
||||
self.eip7594_fork_epoch.map_or(false, |eip7594_fork_epoch| {
|
||||
eip7594_fork_epoch != self.far_future_epoch
|
||||
})
|
||||
self.eip7594_fork_epoch
|
||||
.is_some_and(|eip7594_fork_epoch| eip7594_fork_epoch != self.far_future_epoch)
|
||||
}
|
||||
|
||||
/// Returns a full `Fork` struct for a given epoch.
|
||||
|
||||
@@ -72,8 +72,7 @@ impl DepositTreeSnapshot {
|
||||
Some(Hash256::from_slice(&deposit_root))
|
||||
}
|
||||
pub fn is_valid(&self) -> bool {
|
||||
self.calculate_root()
|
||||
.map_or(false, |calculated| self.deposit_root == calculated)
|
||||
self.calculate_root() == Some(self.deposit_root)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ impl FromStr for GraffitiString {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
if s.as_bytes().len() > GRAFFITI_BYTES_LEN {
|
||||
if s.len() > GRAFFITI_BYTES_LEN {
|
||||
return Err(format!(
|
||||
"Graffiti exceeds max length {}",
|
||||
GRAFFITI_BYTES_LEN
|
||||
|
||||
Reference in New Issue
Block a user