mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
add use_self clippy lint (#8325)
This commit is contained in:
@ -86,7 +86,7 @@ impl Cli {
|
||||
I: IntoIterator<Item = T>,
|
||||
T: Into<OsString> + Clone,
|
||||
{
|
||||
Cli::try_parse_from(itr)
|
||||
Self::try_parse_from(itr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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")
|
||||
|
||||
Reference in New Issue
Block a user