diff --git a/crates/anvil/src/eth/api.rs b/crates/anvil/src/eth/api.rs index d7f875c4fa72..313ecfb4efb9 100644 --- a/crates/anvil/src/eth/api.rs +++ b/crates/anvil/src/eth/api.rs @@ -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?; @@ -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?; diff --git a/crates/cast/bin/main.rs b/crates/cast/bin/main.rs index 8949f5c877ca..b2ac3a66716d 100644 --- a/crates/cast/bin/main.rs +++ b/crates/cast/bin/main.rs @@ -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"))? diff --git a/crates/cheatcodes/src/impls/test/expect.rs b/crates/cheatcodes/src/impls/test/expect.rs index 1551440f5ec0..218fdd1b9c7e 100644 --- a/crates/cheatcodes/src/impls/test/expect.rs +++ b/crates/cheatcodes/src/impls/test/expect.rs @@ -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) diff --git a/crates/doc/src/parser/mod.rs b/crates/doc/src/parser/mod.rs index 5a57535d5c58..4b3e99ce13b0 100644 --- a/crates/doc/src/parser/mod.rs +++ b/crates/doc/src/parser/mod.rs @@ -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"); @@ -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"); diff --git a/crates/evm/src/executor/inspector/cheatcodes/expect.rs b/crates/evm/src/executor/inspector/cheatcodes/expect.rs index 51ff72f91978..a14344a92e96 100644 --- a/crates/evm/src/executor/inspector/cheatcodes/expect.rs +++ b/crates/evm/src/executor/inspector/cheatcodes/expect.rs @@ -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 diff --git a/crates/forge/bin/cmd/script/cmd.rs b/crates/forge/bin/cmd/script/cmd.rs index 77cd60e7837a..556422f4f86b 100644 --- a/crates/forge/bin/cmd/script/cmd.rs +++ b/crates/forge/bin/cmd/script/cmd.rs @@ -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(()) diff --git a/crates/forge/bin/cmd/test/mod.rs b/crates/forge/bin/cmd/test/mod.rs index 3c0e55c0dfdd..21f0ddf04427 100644 --- a/crates/forge/bin/cmd/test/mod.rs +++ b/crates/forge/bin/cmd/test/mod.rs @@ -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,