Skip to content

Commit

Permalink
chore(clippy): make clippy happy (foundry-rs#3468)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Oct 9, 2022
1 parent 88ba80d commit e9eab88
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion anvil/src/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ pub fn filter_logs(
let receipt: EIP658Receipt = receipt.into();
let receipt_logs = receipt.logs;
let transaction_hash: Option<H256> = if !receipt_logs.is_empty() {
Some(block.transactions[receipt_index as usize].hash())
Some(block.transactions[receipt_index].hash())
} else {
None
};
Expand Down
8 changes: 4 additions & 4 deletions anvil/tests/it/proof/eip1186.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ where
}
NodeHandle::Hash(plain_hash) => {
let new_root = decode_hash::<L::Hash>(plain_hash)
.ok_or(VerifyError::HashDecodeError(plain_hash))?;
.ok_or_else(|| VerifyError::HashDecodeError(plain_hash))?;
process_node::<L>(Some(&new_root), &proof[0], key, expected_value, &proof[1..])
}
}
Expand Down Expand Up @@ -235,8 +235,8 @@ where
Err(VerifyError::IncompleteProof)
} else {
key.advance(1);
let new_root =
decode_hash::<L::Hash>(hash).ok_or(VerifyError::HashDecodeError(hash))?;
let new_root = decode_hash::<L::Hash>(hash)
.ok_or_else(|| VerifyError::HashDecodeError(hash))?;
process_node::<L>(Some(&new_root), &proof[0], key, expected_value, &proof[1..])
}
}
Expand Down Expand Up @@ -280,7 +280,7 @@ where
(Some(Value::Node(plain_hash, _)), Some(next_proof_item), Some(value)) => {
let value_hash = L::Hash::hash(value);
let node_hash = decode_hash::<L::Hash>(plain_hash)
.ok_or(VerifyError::HashDecodeError(plain_hash))?;
.ok_or_else(|| VerifyError::HashDecodeError(plain_hash))?;
if node_hash != value_hash {
Err(VerifyError::HashMismatch(node_hash))
} else if next_proof_item != value {
Expand Down
1 change: 1 addition & 0 deletions cli/src/cmd/forge/verify/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub enum VerificationProviderType {

impl VerificationProviderType {
/// Returns the corresponding `VerificationProvider` for the key
#[allow(clippy::box_default)]
pub fn client(&self, key: &Option<String>) -> eyre::Result<Box<dyn VerificationProvider>> {
match self {
VerificationProviderType::Etherscan => {
Expand Down
1 change: 1 addition & 0 deletions common/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ impl ProviderBuilder {

let provider = Http::new_with_client(url, client);

#[allow(clippy::box_default)]
let mut provider = Provider::new(
RetryClientBuilder::default()
.initial_backoff(Duration::from_millis(initial_backoff))
Expand Down
1 change: 1 addition & 0 deletions common/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ pub enum ShellOut {
impl ShellOut {
/// Creates a new shell that writes to memory
pub fn memory() -> Self {
#[allow(clippy::box_default)]
ShellOut::Write(WriteShellOut(Arc::new(Mutex::new(Box::new(Vec::new())))))
}

Expand Down
2 changes: 1 addition & 1 deletion evm/src/executor/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ impl Backend {
for loaded_account in loaded_accounts.iter().copied() {
trace!(?loaded_account, "replacing account on init");
let fork_account = Database::basic(&mut fork.db, loaded_account)?
.ok_or(DatabaseError::MissingAccount(loaded_account))?;
.ok_or_else(|| DatabaseError::MissingAccount(loaded_account))?;
let init_account =
journaled_state.state.get_mut(&loaded_account).expect("exists; qed");
init_account.info = fork_account;
Expand Down
2 changes: 1 addition & 1 deletion evm/src/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Executor {
let create2_deployer_account = self
.backend_mut()
.basic(DEFAULT_CREATE2_DEPLOYER)?
.ok_or(DatabaseError::MissingAccount(DEFAULT_CREATE2_DEPLOYER))?;
.ok_or_else(|| DatabaseError::MissingAccount(DEFAULT_CREATE2_DEPLOYER))?;

if create2_deployer_account.code.is_none() ||
create2_deployer_account.code.as_ref().unwrap().is_empty()
Expand Down

0 comments on commit e9eab88

Please sign in to comment.