Rust 1.89 compiler lint fix (#7644)

Fix lints for Rust 1.89 beta compiler
This commit is contained in:
chonghe
2025-06-25 13:33:17 +08:00
committed by GitHub
parent 56b2d4b525
commit 8e3c5d1524
28 changed files with 86 additions and 70 deletions

View File

@@ -114,7 +114,11 @@ impl<E: EthSpec> KeyValueStore<E> for BeaconNodeBackend<E> {
}
}
fn iter_column_keys_from<K: Key>(&self, _column: DBColumn, from: &[u8]) -> ColumnKeyIter<K> {
fn iter_column_keys_from<K: Key>(
&self,
_column: DBColumn,
from: &[u8],
) -> ColumnKeyIter<'_, K> {
match self {
#[cfg(feature = "leveldb")]
BeaconNodeBackend::LevelDb(txn) => {
@@ -127,7 +131,7 @@ impl<E: EthSpec> KeyValueStore<E> for BeaconNodeBackend<E> {
}
}
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<K> {
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<'_, K> {
match self {
#[cfg(feature = "leveldb")]
BeaconNodeBackend::LevelDb(txn) => leveldb_impl::LevelDB::iter_column_keys(txn, column),
@@ -136,7 +140,7 @@ impl<E: EthSpec> KeyValueStore<E> for BeaconNodeBackend<E> {
}
}
fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<K> {
fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<'_, K> {
match self {
#[cfg(feature = "leveldb")]
BeaconNodeBackend::LevelDb(txn) => {

View File

@@ -47,7 +47,7 @@ impl<E: EthSpec> LevelDB<E> {
})
}
pub fn read_options(&self) -> ReadOptions<BytesKey> {
pub fn read_options(&self) -> ReadOptions<'_, BytesKey> {
ReadOptions::new()
}
@@ -207,7 +207,7 @@ impl<E: EthSpec> LevelDB<E> {
Ok(())
}
pub fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<K> {
pub fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<'_, K> {
let start_key = BytesKey::from_vec(get_key_for_col(column, from));
let iter = self.db.iter(self.read_options());
iter.seek(&start_key);
@@ -231,7 +231,11 @@ impl<E: EthSpec> LevelDB<E> {
)
}
pub fn iter_column_keys_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnKeyIter<K> {
pub fn iter_column_keys_from<K: Key>(
&self,
column: DBColumn,
from: &[u8],
) -> ColumnKeyIter<'_, K> {
let start_key = BytesKey::from_vec(get_key_for_col(column, from));
let iter = self.db.keys_iter(self.read_options());
@@ -253,11 +257,11 @@ impl<E: EthSpec> LevelDB<E> {
}
/// Iterate through all keys and values in a particular column.
pub fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<K> {
pub fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<'_, K> {
self.iter_column_keys_from(column, &vec![0; column.key_size()])
}
pub fn iter_column<K: Key>(&self, column: DBColumn) -> ColumnIter<K> {
pub fn iter_column<K: Key>(&self, column: DBColumn) -> ColumnIter<'_, K> {
self.iter_column_from(column, &vec![0; column.key_size()])
}

View File

@@ -1125,7 +1125,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
start_slot: Slot,
end_slot: Slot,
get_state: impl FnOnce() -> Result<(BeaconState<E>, Hash256), Error>,
) -> Result<HybridForwardsBlockRootsIterator<E, Hot, Cold>, Error> {
) -> Result<HybridForwardsBlockRootsIterator<'_, E, Hot, Cold>, Error> {
HybridForwardsBlockRootsIterator::new(
self,
DBColumn::BeaconBlockRoots,
@@ -1155,7 +1155,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
start_slot: Slot,
end_slot: Slot,
get_state: impl FnOnce() -> Result<(BeaconState<E>, Hash256), Error>,
) -> Result<HybridForwardsStateRootsIterator<E, Hot, Cold>, Error> {
) -> Result<HybridForwardsStateRootsIterator<'_, E, Hot, Cold>, Error> {
HybridForwardsStateRootsIterator::new(
self,
DBColumn::BeaconStateRoots,

View File

@@ -92,17 +92,17 @@ pub trait KeyValueStore<E: EthSpec>: Sync + Send + Sized + 'static {
}
/// Iterate through all keys and values in a particular column.
fn iter_column<K: Key>(&self, column: DBColumn) -> ColumnIter<K> {
fn iter_column<K: Key>(&self, column: DBColumn) -> ColumnIter<'_, K> {
self.iter_column_from(column, &vec![0; column.key_size()])
}
/// Iterate through all keys and values in a column from a given starting point that fulfill the given predicate.
fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<K>;
fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<'_, K>;
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<K>;
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<'_, K>;
/// Iterate through all keys in a particular column.
fn iter_column_keys_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnKeyIter<K>;
fn iter_column_keys_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnKeyIter<'_, K>;
fn delete_batch(&self, column: DBColumn, ops: HashSet<&[u8]>) -> Result<(), Error>;

View File

@@ -80,7 +80,7 @@ impl<E: EthSpec> KeyValueStore<E> for MemoryStore<E> {
Ok(())
}
fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<K> {
fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<'_, K> {
// We use this awkward pattern because we can't lock the `self.db` field *and* maintain a
// reference to the lock guard across calls to `.next()`. This would be require a
// struct with a field (the iterator) which references another field (the lock guard).
@@ -101,7 +101,7 @@ impl<E: EthSpec> KeyValueStore<E> for MemoryStore<E> {
}))
}
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<K> {
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<'_, K> {
Box::new(self.iter_column(column).map(|res| res.map(|(k, _)| k)))
}
@@ -109,7 +109,7 @@ impl<E: EthSpec> KeyValueStore<E> for MemoryStore<E> {
Ok(())
}
fn iter_column_keys_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnKeyIter<K> {
fn iter_column_keys_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnKeyIter<'_, K> {
// We use this awkward pattern because we can't lock the `self.db` field *and* maintain a
// reference to the lock guard across calls to `.next()`. This would be require a
// struct with a field (the iterator) which references another field (the lock guard).