Skip to content

Commit 8e3c5d1

Browse files
authored
Rust 1.89 compiler lint fix (#7644)
Fix lints for Rust 1.89 beta compiler
1 parent 56b2d4b commit 8e3c5d1

File tree

28 files changed

+86
-70
lines changed

28 files changed

+86
-70
lines changed

beacon_node/beacon_chain/src/attestation_verification.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ impl<T: BeaconChainTypes> Clone for IndexedUnaggregatedAttestation<'_, T> {
353353
/// A helper trait implemented on wrapper types that can be progressed to a state where they can be
354354
/// verified for application to fork choice.
355355
pub trait VerifiedAttestation<T: BeaconChainTypes>: Sized {
356-
fn attestation(&self) -> AttestationRef<T::EthSpec>;
356+
fn attestation(&self) -> AttestationRef<'_, T::EthSpec>;
357357

358358
fn indexed_attestation(&self) -> &IndexedAttestation<T::EthSpec>;
359359

@@ -366,7 +366,7 @@ pub trait VerifiedAttestation<T: BeaconChainTypes>: Sized {
366366
}
367367

368368
impl<T: BeaconChainTypes> VerifiedAttestation<T> for VerifiedAggregatedAttestation<'_, T> {
369-
fn attestation(&self) -> AttestationRef<T::EthSpec> {
369+
fn attestation(&self) -> AttestationRef<'_, T::EthSpec> {
370370
self.attestation()
371371
}
372372

@@ -376,7 +376,7 @@ impl<T: BeaconChainTypes> VerifiedAttestation<T> for VerifiedAggregatedAttestati
376376
}
377377

378378
impl<T: BeaconChainTypes> VerifiedAttestation<T> for VerifiedUnaggregatedAttestation<'_, T> {
379-
fn attestation(&self) -> AttestationRef<T::EthSpec> {
379+
fn attestation(&self) -> AttestationRef<'_, T::EthSpec> {
380380
self.attestation.to_ref()
381381
}
382382

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7080,7 +7080,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
70807080
&self,
70817081
block_root: Hash256,
70827082
block_data: AvailableBlockData<T::EthSpec>,
7083-
) -> Result<Option<StoreOp<T::EthSpec>>, String> {
7083+
) -> Result<Option<StoreOp<'_, T::EthSpec>>, String> {
70847084
match block_data {
70857085
AvailableBlockData::NoData => Ok(None),
70867086
AvailableBlockData::Blobs(blobs) => {

beacon_node/beacon_chain/src/block_verification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ pub fn cheap_state_advance_to_obtain_committees<'a, E: EthSpec, Err: BlockBlobEr
20422042
/// Obtains a read-locked `ValidatorPubkeyCache` from the `chain`.
20432043
pub fn get_validator_pubkey_cache<T: BeaconChainTypes>(
20442044
chain: &BeaconChain<T>,
2045-
) -> Result<RwLockReadGuard<ValidatorPubkeyCache<T>>, BeaconChainError> {
2045+
) -> Result<RwLockReadGuard<'_, ValidatorPubkeyCache<T>>, BeaconChainError> {
20462046
Ok(chain.validator_pubkey_cache.read())
20472047
}
20482048

beacon_node/beacon_chain/src/block_verification_types.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ pub trait AsBlock<E: EthSpec> {
365365
fn parent_root(&self) -> Hash256;
366366
fn state_root(&self) -> Hash256;
367367
fn signed_block_header(&self) -> SignedBeaconBlockHeader;
368-
fn message(&self) -> BeaconBlockRef<E>;
368+
fn message(&self) -> BeaconBlockRef<'_, E>;
369369
fn as_block(&self) -> &SignedBeaconBlock<E>;
370370
fn block_cloned(&self) -> Arc<SignedBeaconBlock<E>>;
371371
fn canonical_root(&self) -> Hash256;
@@ -392,7 +392,7 @@ impl<E: EthSpec> AsBlock<E> for Arc<SignedBeaconBlock<E>> {
392392
SignedBeaconBlock::signed_block_header(self)
393393
}
394394

395-
fn message(&self) -> BeaconBlockRef<E> {
395+
fn message(&self) -> BeaconBlockRef<'_, E> {
396396
SignedBeaconBlock::message(self)
397397
}
398398

@@ -425,7 +425,7 @@ impl<E: EthSpec> AsBlock<E> for MaybeAvailableBlock<E> {
425425
fn signed_block_header(&self) -> SignedBeaconBlockHeader {
426426
self.as_block().signed_block_header()
427427
}
428-
fn message(&self) -> BeaconBlockRef<E> {
428+
fn message(&self) -> BeaconBlockRef<'_, E> {
429429
self.as_block().message()
430430
}
431431
fn as_block(&self) -> &SignedBeaconBlock<E> {
@@ -466,7 +466,7 @@ impl<E: EthSpec> AsBlock<E> for AvailableBlock<E> {
466466
self.block().signed_block_header()
467467
}
468468

469-
fn message(&self) -> BeaconBlockRef<E> {
469+
fn message(&self) -> BeaconBlockRef<'_, E> {
470470
self.block().message()
471471
}
472472

@@ -499,7 +499,7 @@ impl<E: EthSpec> AsBlock<E> for RpcBlock<E> {
499499
fn signed_block_header(&self) -> SignedBeaconBlockHeader {
500500
self.as_block().signed_block_header()
501501
}
502-
fn message(&self) -> BeaconBlockRef<E> {
502+
fn message(&self) -> BeaconBlockRef<'_, E> {
503503
self.as_block().message()
504504
}
505505
fn as_block(&self) -> &SignedBeaconBlock<E> {

beacon_node/beacon_chain/src/canonical_head.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ impl<T> CanonicalHeadRwLock<T> {
7373
Self::from(RwLock::new(item))
7474
}
7575

76-
fn read(&self) -> RwLockReadGuard<T> {
76+
fn read(&self) -> RwLockReadGuard<'_, T> {
7777
self.0.read()
7878
}
7979

80-
fn write(&self) -> RwLockWriteGuard<T> {
80+
fn write(&self) -> RwLockWriteGuard<'_, T> {
8181
self.0.write()
8282
}
8383
}
@@ -369,26 +369,26 @@ impl<T: BeaconChainTypes> CanonicalHead<T> {
369369
///
370370
/// This function is **not safe** to be public. See the module-level documentation for more
371371
/// information about protecting from deadlocks.
372-
fn cached_head_read_lock(&self) -> RwLockReadGuard<CachedHead<T::EthSpec>> {
372+
fn cached_head_read_lock(&self) -> RwLockReadGuard<'_, CachedHead<T::EthSpec>> {
373373
self.cached_head.read()
374374
}
375375

376376
/// Access a write-lock for the cached head.
377377
///
378378
/// This function is **not safe** to be public. See the module-level documentation for more
379379
/// information about protecting from deadlocks.
380-
fn cached_head_write_lock(&self) -> RwLockWriteGuard<CachedHead<T::EthSpec>> {
380+
fn cached_head_write_lock(&self) -> RwLockWriteGuard<'_, CachedHead<T::EthSpec>> {
381381
self.cached_head.write()
382382
}
383383

384384
/// Access a read-lock for fork choice.
385-
pub fn fork_choice_read_lock(&self) -> RwLockReadGuard<BeaconForkChoice<T>> {
385+
pub fn fork_choice_read_lock(&self) -> RwLockReadGuard<'_, BeaconForkChoice<T>> {
386386
let _timer = metrics::start_timer(&metrics::FORK_CHOICE_READ_LOCK_AQUIRE_TIMES);
387387
self.fork_choice.read()
388388
}
389389

390390
/// Access a write-lock for fork choice.
391-
pub fn fork_choice_write_lock(&self) -> RwLockWriteGuard<BeaconForkChoice<T>> {
391+
pub fn fork_choice_write_lock(&self) -> RwLockWriteGuard<'_, BeaconForkChoice<T>> {
392392
let _timer = metrics::start_timer(&metrics::FORK_CHOICE_WRITE_LOCK_AQUIRE_TIMES);
393393
self.fork_choice.write()
394394
}

beacon_node/beacon_chain/src/kzg_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn ssz_blob_to_crypto_blob_boxed<E: EthSpec>(blob: &Blob<E>) -> Result<Box<KzgBl
2525

2626
/// Converts a cell ssz List object to an array to be used with the kzg
2727
/// crypto library.
28-
fn ssz_cell_to_crypto_cell<E: EthSpec>(cell: &Cell<E>) -> Result<KzgCellRef, KzgError> {
28+
fn ssz_cell_to_crypto_cell<E: EthSpec>(cell: &Cell<E>) -> Result<KzgCellRef<'_>, KzgError> {
2929
let cell_bytes: &[u8] = cell.as_ref();
3030
Ok(cell_bytes
3131
.try_into()

beacon_node/execution_layer/src/engine_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ pub enum GetPayloadResponseType<E: EthSpec> {
380380
}
381381

382382
impl<E: EthSpec> GetPayloadResponse<E> {
383-
pub fn execution_payload_ref(&self) -> ExecutionPayloadRef<E> {
383+
pub fn execution_payload_ref(&self) -> ExecutionPayloadRef<'_, E> {
384384
self.to_ref().into()
385385
}
386386
}

beacon_node/network/src/network_beacon_processor/gossip_methods.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct VerifiedUnaggregate<T: BeaconChainTypes> {
6767
/// This implementation allows `Self` to be imported to fork choice and other functions on the
6868
/// `BeaconChain`.
6969
impl<T: BeaconChainTypes> VerifiedAttestation<T> for VerifiedUnaggregate<T> {
70-
fn attestation(&self) -> AttestationRef<T::EthSpec> {
70+
fn attestation(&self) -> AttestationRef<'_, T::EthSpec> {
7171
self.attestation.to_ref()
7272
}
7373

@@ -100,7 +100,7 @@ struct VerifiedAggregate<T: BeaconChainTypes> {
100100
/// This implementation allows `Self` to be imported to fork choice and other functions on the
101101
/// `BeaconChain`.
102102
impl<T: BeaconChainTypes> VerifiedAttestation<T> for VerifiedAggregate<T> {
103-
fn attestation(&self) -> AttestationRef<T::EthSpec> {
103+
fn attestation(&self) -> AttestationRef<'_, T::EthSpec> {
104104
self.signed_aggregate.message().aggregate()
105105
}
106106

beacon_node/operation_pool/src/attestation_storage.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<E: EthSpec> SplitAttestation<E> {
9696
}
9797
}
9898

99-
pub fn as_ref(&self) -> CompactAttestationRef<E> {
99+
pub fn as_ref(&self) -> CompactAttestationRef<'_, E> {
100100
CompactAttestationRef {
101101
checkpoint: &self.checkpoint,
102102
data: &self.data,
@@ -438,7 +438,7 @@ impl<E: EthSpec> AttestationMap<E> {
438438
}
439439

440440
/// Iterate all attestations in the map.
441-
pub fn iter(&self) -> impl Iterator<Item = CompactAttestationRef<E>> {
441+
pub fn iter(&self) -> impl Iterator<Item = CompactAttestationRef<'_, E>> {
442442
self.checkpoint_map
443443
.iter()
444444
.flat_map(|(checkpoint_key, attestation_map)| attestation_map.iter(checkpoint_key))

beacon_node/store/src/database/interface.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ impl<E: EthSpec> KeyValueStore<E> for BeaconNodeBackend<E> {
114114
}
115115
}
116116

117-
fn iter_column_keys_from<K: Key>(&self, _column: DBColumn, from: &[u8]) -> ColumnKeyIter<K> {
117+
fn iter_column_keys_from<K: Key>(
118+
&self,
119+
_column: DBColumn,
120+
from: &[u8],
121+
) -> ColumnKeyIter<'_, K> {
118122
match self {
119123
#[cfg(feature = "leveldb")]
120124
BeaconNodeBackend::LevelDb(txn) => {
@@ -127,7 +131,7 @@ impl<E: EthSpec> KeyValueStore<E> for BeaconNodeBackend<E> {
127131
}
128132
}
129133

130-
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<K> {
134+
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<'_, K> {
131135
match self {
132136
#[cfg(feature = "leveldb")]
133137
BeaconNodeBackend::LevelDb(txn) => leveldb_impl::LevelDB::iter_column_keys(txn, column),
@@ -136,7 +140,7 @@ impl<E: EthSpec> KeyValueStore<E> for BeaconNodeBackend<E> {
136140
}
137141
}
138142

139-
fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<K> {
143+
fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<'_, K> {
140144
match self {
141145
#[cfg(feature = "leveldb")]
142146
BeaconNodeBackend::LevelDb(txn) => {

0 commit comments

Comments
 (0)