mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Rust 1.89 compiler lint fix (#7644)
Fix lints for Rust 1.89 beta compiler
This commit is contained in:
@@ -511,7 +511,7 @@ pub enum AttestationOnDisk<E: EthSpec> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> AttestationOnDisk<E> {
|
||||
pub fn to_ref(&self) -> AttestationRefOnDisk<E> {
|
||||
pub fn to_ref(&self) -> AttestationRefOnDisk<'_, E> {
|
||||
match self {
|
||||
AttestationOnDisk::Base(att) => AttestationRefOnDisk::Base(att),
|
||||
AttestationOnDisk::Electra(att) => AttestationRefOnDisk::Electra(att),
|
||||
|
||||
@@ -141,7 +141,7 @@ impl<'a, E: EthSpec> AttesterSlashingRef<'a, E> {
|
||||
}
|
||||
|
||||
impl<E: EthSpec> AttesterSlashing<E> {
|
||||
pub fn attestation_1(&self) -> IndexedAttestationRef<E> {
|
||||
pub fn attestation_1(&self) -> IndexedAttestationRef<'_, E> {
|
||||
match self {
|
||||
AttesterSlashing::Base(attester_slashing) => {
|
||||
IndexedAttestationRef::Base(&attester_slashing.attestation_1)
|
||||
@@ -152,7 +152,7 @@ impl<E: EthSpec> AttesterSlashing<E> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn attestation_2(&self) -> IndexedAttestationRef<E> {
|
||||
pub fn attestation_2(&self) -> IndexedAttestationRef<'_, E> {
|
||||
match self {
|
||||
AttesterSlashing::Base(attester_slashing) => {
|
||||
IndexedAttestationRef::Base(&attester_slashing.attestation_2)
|
||||
|
||||
@@ -808,7 +808,7 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
&self,
|
||||
slot: Slot,
|
||||
index: CommitteeIndex,
|
||||
) -> Result<BeaconCommittee, Error> {
|
||||
) -> Result<BeaconCommittee<'_>, Error> {
|
||||
let epoch = slot.epoch(E::slots_per_epoch());
|
||||
let relative_epoch = RelativeEpoch::from_epoch(self.current_epoch(), epoch)?;
|
||||
let cache = self.committee_cache(relative_epoch)?;
|
||||
@@ -823,7 +823,10 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
/// Utilises the committee cache.
|
||||
///
|
||||
/// Spec v0.12.1
|
||||
pub fn get_beacon_committees_at_slot(&self, slot: Slot) -> Result<Vec<BeaconCommittee>, Error> {
|
||||
pub fn get_beacon_committees_at_slot(
|
||||
&self,
|
||||
slot: Slot,
|
||||
) -> Result<Vec<BeaconCommittee<'_>>, Error> {
|
||||
let cache = self.committee_cache_at_slot(slot)?;
|
||||
cache.get_beacon_committees_at_slot(slot)
|
||||
}
|
||||
@@ -836,7 +839,7 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
pub fn get_beacon_committees_at_epoch(
|
||||
&self,
|
||||
relative_epoch: RelativeEpoch,
|
||||
) -> Result<Vec<BeaconCommittee>, Error> {
|
||||
) -> Result<Vec<BeaconCommittee<'_>>, Error> {
|
||||
let cache = self.committee_cache(relative_epoch)?;
|
||||
cache.get_all_beacon_committees()
|
||||
}
|
||||
@@ -1016,7 +1019,9 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
}
|
||||
|
||||
/// Convenience accessor for the `execution_payload_header` as an `ExecutionPayloadHeaderRef`.
|
||||
pub fn latest_execution_payload_header(&self) -> Result<ExecutionPayloadHeaderRef<E>, Error> {
|
||||
pub fn latest_execution_payload_header(
|
||||
&self,
|
||||
) -> Result<ExecutionPayloadHeaderRef<'_, E>, Error> {
|
||||
match self {
|
||||
BeaconState::Base(_) | BeaconState::Altair(_) => Err(Error::IncorrectStateVariant),
|
||||
BeaconState::Bellatrix(state) => Ok(ExecutionPayloadHeaderRef::Bellatrix(
|
||||
@@ -1039,7 +1044,7 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
|
||||
pub fn latest_execution_payload_header_mut(
|
||||
&mut self,
|
||||
) -> Result<ExecutionPayloadHeaderRefMut<E>, Error> {
|
||||
) -> Result<ExecutionPayloadHeaderRefMut<'_, E>, Error> {
|
||||
match self {
|
||||
BeaconState::Base(_) | BeaconState::Altair(_) => Err(Error::IncorrectStateVariant),
|
||||
BeaconState::Bellatrix(state) => Ok(ExecutionPayloadHeaderRefMut::Bellatrix(
|
||||
@@ -1713,7 +1718,7 @@ impl<E: EthSpec> BeaconState<E> {
|
||||
pub fn get_validator_cow(
|
||||
&mut self,
|
||||
validator_index: usize,
|
||||
) -> Result<milhouse::Cow<Validator>, Error> {
|
||||
) -> Result<milhouse::Cow<'_, Validator>, Error> {
|
||||
self.validators_mut()
|
||||
.get_cow(validator_index)
|
||||
.ok_or(Error::UnknownValidator(validator_index))
|
||||
|
||||
@@ -159,7 +159,7 @@ impl CommitteeCache {
|
||||
&self,
|
||||
slot: Slot,
|
||||
index: CommitteeIndex,
|
||||
) -> Option<BeaconCommittee> {
|
||||
) -> Option<BeaconCommittee<'_>> {
|
||||
if self.initialized_epoch.is_none()
|
||||
|| !self.is_initialized_at(slot.epoch(self.slots_per_epoch))
|
||||
|| index >= self.committees_per_slot
|
||||
@@ -185,7 +185,10 @@ impl CommitteeCache {
|
||||
/// Get all the Beacon committees at a given `slot`.
|
||||
///
|
||||
/// Committees are sorted by ascending index order 0..committees_per_slot
|
||||
pub fn get_beacon_committees_at_slot(&self, slot: Slot) -> Result<Vec<BeaconCommittee>, Error> {
|
||||
pub fn get_beacon_committees_at_slot(
|
||||
&self,
|
||||
slot: Slot,
|
||||
) -> Result<Vec<BeaconCommittee<'_>>, Error> {
|
||||
if self.initialized_epoch.is_none() {
|
||||
return Err(Error::CommitteeCacheUninitialized(None));
|
||||
}
|
||||
@@ -199,7 +202,7 @@ impl CommitteeCache {
|
||||
}
|
||||
|
||||
/// Returns all committees for `self.initialized_epoch`.
|
||||
pub fn get_all_beacon_committees(&self) -> Result<Vec<BeaconCommittee>, Error> {
|
||||
pub fn get_all_beacon_committees(&self) -> Result<Vec<BeaconCommittee<'_>>, Error> {
|
||||
let initialized_epoch = self
|
||||
.initialized_epoch
|
||||
.ok_or(Error::CommitteeCacheUninitialized(None))?;
|
||||
|
||||
@@ -118,7 +118,7 @@ impl Epoch {
|
||||
.as_u64())
|
||||
}
|
||||
|
||||
pub fn slot_iter(&self, slots_per_epoch: u64) -> SlotIter {
|
||||
pub fn slot_iter(&self, slots_per_epoch: u64) -> SlotIter<'_> {
|
||||
SlotIter {
|
||||
current_iteration: 0,
|
||||
epoch: self,
|
||||
|
||||
@@ -8,7 +8,7 @@ use rusqlite::{
|
||||
macro_rules! impl_to_from_sql {
|
||||
($type:ty) => {
|
||||
impl ToSql for $type {
|
||||
fn to_sql(&self) -> Result<ToSqlOutput, Error> {
|
||||
fn to_sql(&self) -> Result<ToSqlOutput<'_>, Error> {
|
||||
let val_i64 = i64::try_from(self.as_u64())
|
||||
.map_err(|e| Error::ToSqlConversionFailure(Box::new(e)))?;
|
||||
Ok(ToSqlOutput::from(val_i64))
|
||||
|
||||
Reference in New Issue
Block a user