Skip to content

Commit

Permalink
chore: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Oct 26, 2023
1 parent 8270420 commit 1c342cc
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions crates/anvil/src/eth/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ impl EthApi {
node_info!("eth_signTransaction");

let from = request.from.map(Ok).unwrap_or_else(|| {
self.accounts()?.get(0).cloned().ok_or(BlockchainError::NoSignerAvailable)
self.accounts()?.first().cloned().ok_or(BlockchainError::NoSignerAvailable)
})?;

let (nonce, _) = self.request_nonce(&request, from).await?;
Expand All @@ -824,7 +824,7 @@ impl EthApi {
node_info!("eth_sendTransaction");

let from = request.from.map(Ok).unwrap_or_else(|| {
self.accounts()?.get(0).cloned().ok_or(BlockchainError::NoSignerAvailable)
self.accounts()?.first().cloned().ok_or(BlockchainError::NoSignerAvailable)
})?;

let (nonce, on_chain_nonce) = self.request_nonce(&request, from).await?;
Expand Down
2 changes: 1 addition & 1 deletion crates/cast/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ async fn main() -> Result<()> {

let sig = match sigs.len() {
0 => eyre::bail!("No signatures found"),
1 => sigs.get(0).unwrap(),
1 => sigs.first().unwrap(),
_ => {
let i: usize = prompt!("Select a function signature by number: ")?;
sigs.get(i - 1).ok_or_else(|| eyre::eyre!("Invalid signature index"))?
Expand Down
4 changes: 2 additions & 2 deletions crates/cheatcodes/src/impls/test/expect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ pub(crate) fn handle_expect_emit(
return
};

let expected_topic_0 = expected.topics().get(0);
let log_topic_0 = topics.get(0);
let expected_topic_0 = expected.topics().first();
let log_topic_0 = topics.first();

if expected_topic_0
.zip(log_topic_0)
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/executor/inspector/cheatcodes/expect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ pub fn handle_expect_emit(state: &mut Cheatcodes, log: RawLog, address: &Address

match event_to_fill_or_check.log {
Some(ref expected) => {
let expected_topic_0 = expected.topics().get(0);
let log_topic_0 = log.topics().get(0);
let expected_topic_0 = expected.topics().first();
let log_topic_0 = log.topics().first();

// same topic0 and equal number of topics should be verified further, others are a no
// match
Expand Down
2 changes: 1 addition & 1 deletion crates/forge/bin/cmd/script/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ impl ScriptArgs {
}
if let Some(wallets) = self.wallets.private_keys()? {
if wallets.len() == 1 {
script_config.evm_opts.sender = wallets.get(0).unwrap().address().to_alloy()
script_config.evm_opts.sender = wallets.first().unwrap().address().to_alloy()
}
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/forge/bin/cmd/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl TestArgs {
}
let test_funcs = runner.get_matching_test_functions(&filter);
// if we debug a fuzz test, we should not collect data on the first run
if !test_funcs.get(0).expect("matching function exists").inputs.is_empty() {
if !test_funcs.first().expect("matching function exists").inputs.is_empty() {
runner_builder = runner_builder.set_debug(false);
runner = runner_builder.clone().build(
project_root,
Expand Down
2 changes: 1 addition & 1 deletion crates/zkcast/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ async fn main() -> Result<()> {

let sig = match sigs.len() {
0 => eyre::bail!("No signatures found"),
1 => sigs.get(0).unwrap(),
1 => sigs.first().unwrap(),
_ => {
let i: usize = prompt!("Select a function signature by number: ")?;
sigs.get(i - 1).ok_or_else(|| eyre::eyre!("Invalid signature index"))?
Expand Down
2 changes: 1 addition & 1 deletion crates/zkforge/bin/cmd/script/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ impl ScriptArgs {
}
if let Some(wallets) = self.wallets.private_keys()? {
if wallets.len() == 1 {
script_config.evm_opts.sender = wallets.get(0).unwrap().address().to_alloy()
script_config.evm_opts.sender = wallets.first().unwrap().address().to_alloy()
}
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/zkforge/bin/cmd/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl TestArgs {
}
let test_funcs = runner.get_matching_test_functions(&filter);
// if we debug a fuzz test, we should not collect data on the first run
if !test_funcs.get(0).expect("matching function exists").inputs.is_empty() {
if !test_funcs.first().expect("matching function exists").inputs.is_empty() {
runner_builder = runner_builder.set_debug(false);
runner = runner_builder.clone().build(
project_root,
Expand Down

0 comments on commit 1c342cc

Please sign in to comment.