Skip to content

Commit

Permalink
chore: make clippy happy (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Dec 27, 2024
1 parent 5622f23 commit 471b42c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
8 changes: 5 additions & 3 deletions src/tracing/builder/parity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,11 @@ where
fn next(&mut self) -> Option<Self::Item> {
// ensure the selfdestruct trace is emitted just at the ending of the same depth
if let Some(selfdestruct) = &self.next_selfdestruct {
if self.iter.peek().map_or(true, |(next_trace, _)| {
selfdestruct.trace_address < next_trace.trace_address
}) {
if self
.iter
.peek()
.is_none_or(|(next_trace, _)| selfdestruct.trace_address < next_trace.trace_address)
{
return self.next_selfdestruct.take();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ impl TracingInspectorConfig {
/// Otherwise, always returns true.
#[inline]
pub fn should_record_opcode(&self, op: OpCode) -> bool {
self.record_opcodes_filter.as_ref().map_or(true, |filter| filter.is_enabled(op))
self.record_opcodes_filter.as_ref().is_none_or(|filter| filter.is_enabled(op))
}
}

Expand Down
19 changes: 7 additions & 12 deletions src/tracing/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,13 @@ pub(crate) fn load_account_code<DB: DatabaseRef>(
db: DB,
db_acc: &revm::primitives::AccountInfo,
) -> Option<Bytes> {
db_acc
.code
.as_ref()
.map(|code| code.original_bytes())
.or_else(|| {
if db_acc.code_hash == KECCAK_EMPTY {
None
} else {
db.code_by_hash_ref(db_acc.code_hash).ok().map(|code| code.original_bytes())
}
})
.map(Into::into)
db_acc.code.as_ref().map(|code| code.original_bytes()).or_else(|| {
if db_acc.code_hash == KECCAK_EMPTY {
None
} else {
db.code_by_hash_ref(db_acc.code_hash).ok().map(|code| code.original_bytes())
}
})
}

/// Returns a non empty revert reason if the output is a revert/error.
Expand Down

0 comments on commit 471b42c

Please sign in to comment.