mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(clippy): enable if_then_some_else_none lint (#11679)
Signed-off-by: jsvisa <delweng@gmail.com> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -542,18 +542,18 @@ impl<TX: DbTx, Spec: Send + Sync> DatabaseProvider<TX, Spec> {
|
||||
// even if empty
|
||||
let withdrawals =
|
||||
if self.chain_spec.is_shanghai_active_at_timestamp(header_ref.timestamp) {
|
||||
Some(
|
||||
withdrawals_cursor
|
||||
.seek_exact(header_ref.number)?
|
||||
.map(|(_, w)| w.withdrawals)
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
withdrawals_cursor
|
||||
.seek_exact(header_ref.number)?
|
||||
.map(|(_, w)| w.withdrawals)
|
||||
.unwrap_or_default()
|
||||
.into()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let requests =
|
||||
if self.chain_spec.is_prague_active_at_timestamp(header_ref.timestamp) {
|
||||
Some(requests_cursor.seek_exact(header_ref.number)?.unwrap_or_default().1)
|
||||
(requests_cursor.seek_exact(header_ref.number)?.unwrap_or_default().1)
|
||||
.into()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
@ -222,7 +222,7 @@ impl StaticFileProviderInner {
|
||||
/// Creates a new [`StaticFileProviderInner`].
|
||||
fn new(path: impl AsRef<Path>, access: StaticFileAccess) -> ProviderResult<Self> {
|
||||
let _lock_file = if access.is_read_write() {
|
||||
Some(StorageLock::try_acquire(path.as_ref())?)
|
||||
StorageLock::try_acquire(path.as_ref())?.into()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
@ -289,16 +289,16 @@ impl StaticFileProviderRW {
|
||||
//
|
||||
// If that expected block start is 0, then it means that there's no actual block data, and
|
||||
// there's no block data in static files.
|
||||
let segment_max_block = match self.writer.user_header().block_range() {
|
||||
Some(block_range) => Some(block_range.end()),
|
||||
None => {
|
||||
if self.writer.user_header().expected_block_start() > 0 {
|
||||
Some(self.writer.user_header().expected_block_start() - 1)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
};
|
||||
let segment_max_block = self
|
||||
.writer
|
||||
.user_header()
|
||||
.block_range()
|
||||
.as_ref()
|
||||
.map(|block_range| block_range.end())
|
||||
.or_else(|| {
|
||||
(self.writer.user_header().expected_block_start() > 0)
|
||||
.then(|| self.writer.user_header().expected_block_start() - 1)
|
||||
});
|
||||
|
||||
self.reader().update_index(self.writer.user_header().segment(), segment_max_block)
|
||||
}
|
||||
|
||||
@ -344,13 +344,8 @@ impl TransactionsProvider for MockEthProvider {
|
||||
.values()
|
||||
.flat_map(|block| &block.body.transactions)
|
||||
.enumerate()
|
||||
.filter_map(|(tx_number, tx)| {
|
||||
if range.contains(&(tx_number as TxNumber)) {
|
||||
Some(tx.clone().into())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.filter(|&(tx_number, _)| range.contains(&(tx_number as TxNumber)))
|
||||
.map(|(_, tx)| tx.clone().into())
|
||||
.collect();
|
||||
|
||||
Ok(transactions)
|
||||
@ -366,11 +361,7 @@ impl TransactionsProvider for MockEthProvider {
|
||||
.flat_map(|block| &block.body.transactions)
|
||||
.enumerate()
|
||||
.filter_map(|(tx_number, tx)| {
|
||||
if range.contains(&(tx_number as TxNumber)) {
|
||||
Some(tx.recover_signer()?)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
range.contains(&(tx_number as TxNumber)).then(|| tx.recover_signer()).flatten()
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user