Skip to content

Commit

Permalink
chore: new clippy (foundry-rs#6080)
Browse files Browse the repository at this point in the history
  • Loading branch information
Evalir authored Oct 22, 2023
1 parent 2937e4f commit 0409342
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 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/doc/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ mod tests {
);
assert_eq!(items.len(), 3);

let first_item = items.get(0).unwrap();
let first_item = items.first().unwrap();
assert!(matches!(first_item.source, ParseSource::Contract(_)));
assert_eq!(first_item.source.ident(), "A");

Expand Down Expand Up @@ -309,7 +309,7 @@ mod tests {

assert_eq!(items.len(), 2);

let event = items.get(0).unwrap();
let event = items.first().unwrap();
assert!(event.comments.is_empty());
assert!(event.children.is_empty());
assert_eq!(event.source.ident(), "TopLevelEvent");
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 @@ -218,7 +218,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 0409342

Please sign in to comment.