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

@@ -147,7 +147,7 @@ pub trait TargetArrayChunk: Sized + serde::Serialize + serde::de::DeserializeOwn
fn next_start_epoch(start_epoch: Epoch, config: &Config) -> Epoch;
fn select_db<E: EthSpec>(db: &SlasherDB<E>) -> &Database;
fn select_db<E: EthSpec>(db: &SlasherDB<E>) -> &Database<'_>;
fn load<E: EthSpec>(
db: &SlasherDB<E>,
@@ -290,7 +290,7 @@ impl TargetArrayChunk for MinTargetChunk {
start_epoch / chunk_size * chunk_size - 1
}
fn select_db<E: EthSpec>(db: &SlasherDB<E>) -> &Database {
fn select_db<E: EthSpec>(db: &SlasherDB<E>) -> &Database<'_> {
&db.databases.min_targets_db
}
}
@@ -389,7 +389,7 @@ impl TargetArrayChunk for MaxTargetChunk {
(start_epoch / chunk_size + 1) * chunk_size
}
fn select_db<E: EthSpec>(db: &SlasherDB<E>) -> &Database {
fn select_db<E: EthSpec>(db: &SlasherDB<E>) -> &Database<'_> {
&db.databases.max_targets_db
}
}

View File

@@ -331,7 +331,7 @@ impl<E: EthSpec> SlasherDB<E> {
Ok(db)
}
pub fn begin_rw_txn(&self) -> Result<RwTransaction, Error> {
pub fn begin_rw_txn(&self) -> Result<RwTransaction<'_>, Error> {
self.env.begin_rw_txn()
}

View File

@@ -83,7 +83,7 @@ impl Environment {
}
}
pub fn create_databases(&self) -> Result<OpenDatabases, Error> {
pub fn create_databases(&self) -> Result<OpenDatabases<'_>, Error> {
match self {
#[cfg(feature = "mdbx")]
Self::Mdbx(env) => env.create_databases(),
@@ -95,7 +95,7 @@ impl Environment {
}
}
pub fn begin_rw_txn(&self) -> Result<RwTransaction, Error> {
pub fn begin_rw_txn(&self) -> Result<RwTransaction<'_>, Error> {
match self {
#[cfg(feature = "mdbx")]
Self::Mdbx(env) => env.begin_rw_txn().map(RwTransaction::Mdbx),
@@ -194,7 +194,7 @@ impl<'env> RwTransaction<'env> {
impl Cursor<'_> {
/// Return the first key in the current database while advancing the cursor's position.
pub fn first_key(&mut self) -> Result<Option<Key>, Error> {
pub fn first_key(&mut self) -> Result<Option<Key<'_>>, Error> {
match self {
#[cfg(feature = "mdbx")]
Cursor::Mdbx(cursor) => cursor.first_key(),
@@ -207,7 +207,7 @@ impl Cursor<'_> {
}
/// Return the last key in the current database while advancing the cursor's position.
pub fn last_key(&mut self) -> Result<Option<Key>, Error> {
pub fn last_key(&mut self) -> Result<Option<Key<'_>>, Error> {
match self {
#[cfg(feature = "mdbx")]
Cursor::Mdbx(cursor) => cursor.last_key(),
@@ -219,7 +219,7 @@ impl Cursor<'_> {
}
}
pub fn next_key(&mut self) -> Result<Option<Key>, Error> {
pub fn next_key(&mut self) -> Result<Option<Key<'_>>, Error> {
match self {
#[cfg(feature = "mdbx")]
Cursor::Mdbx(cursor) => cursor.next_key(),

View File

@@ -41,7 +41,7 @@ impl Environment {
Ok(Environment { env })
}
pub fn create_databases(&self) -> Result<OpenDatabases, Error> {
pub fn create_databases(&self) -> Result<OpenDatabases<'_>, Error> {
let indexed_attestation_db = self
.env
.create_db(Some(INDEXED_ATTESTATION_DB), Self::db_flags())?;
@@ -80,7 +80,7 @@ impl Environment {
})
}
pub fn begin_rw_txn(&self) -> Result<RwTransaction, Error> {
pub fn begin_rw_txn(&self) -> Result<RwTransaction<'_>, Error> {
let txn = self.env.begin_rw_txn()?;
Ok(RwTransaction { txn })
}
@@ -137,7 +137,7 @@ impl<'env> RwTransaction<'env> {
}
impl<'env> Cursor<'env> {
pub fn first_key(&mut self) -> Result<Option<Key>, Error> {
pub fn first_key(&mut self) -> Result<Option<Key<'_>>, Error> {
let opt_key = self
.cursor
.get(None, None, MDB_FIRST)