add use_self clippy lint (#8325)

This commit is contained in:
Thomas Coratger
2024-05-29 15:14:14 +02:00
committed by GitHub
parent 0cb5358fef
commit 19c529e8df
200 changed files with 1817 additions and 1954 deletions

View File

@ -86,7 +86,7 @@ impl Cli {
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
{
Cli::try_parse_from(itr)
Self::try_parse_from(itr)
}
}

View File

@ -67,19 +67,19 @@ impl<T: Table> Entries<T> {
/// if needed.
fn set(&mut self, new_entries: Vec<TableRow<T>>) {
match self {
Entries::RawValues(old_entries) => {
Self::RawValues(old_entries) => {
*old_entries =
new_entries.into_iter().map(|(key, value)| (key, value.into())).collect()
}
Entries::Values(old_entries) => *old_entries = new_entries,
Self::Values(old_entries) => *old_entries = new_entries,
}
}
/// Returns the length of internal [Vec].
fn len(&self) -> usize {
match self {
Entries::RawValues(entries) => entries.len(),
Entries::Values(entries) => entries.len(),
Self::RawValues(entries) => entries.len(),
Self::Values(entries) => entries.len(),
}
}

View File

@ -197,13 +197,13 @@ impl Subcommands {
let provider = factory.provider()?;
let last = provider.last_block_number()?;
let target = match self {
Subcommands::ToBlock { target } => match target {
Self::ToBlock { target } => match target {
BlockHashOrNumber::Hash(hash) => provider
.block_number(*hash)?
.ok_or_else(|| eyre::eyre!("Block hash not found in database: {hash:?}"))?,
BlockHashOrNumber::Number(num) => *num,
},
Subcommands::NumBlocks { amount } => last.saturating_sub(*amount),
Self::NumBlocks { amount } => last.saturating_sub(*amount),
} + 1;
if target > last {
eyre::bail!("Target block number is higher than the latest block number")