diff --git a/cli/src/cmd/forge/test/filter.rs b/cli/src/cmd/forge/test/filter.rs index 5050bb3b6..58877b05d 100644 --- a/cli/src/cmd/forge/test/filter.rs +++ b/cli/src/cmd/forge/test/filter.rs @@ -90,10 +90,10 @@ impl FileFilter for FilterArgs { fn is_match(&self, file: &Path) -> bool { if let Some(file) = file.as_os_str().to_str() { if let Some(ref glob) = self.path_pattern { - return glob.is_match(file); + return glob.is_match(file) } if let Some(ref glob) = self.path_pattern_inverse { - return !glob.is_match(file); + return !glob.is_match(file) } } file.is_sol_test() diff --git a/cli/src/cmd/forge/test/mod.rs b/cli/src/cmd/forge/test/mod.rs index ec2d51ded..8e6c7c4c1 100644 --- a/cli/src/cmd/forge/test/mod.rs +++ b/cli/src/cmd/forge/test/mod.rs @@ -144,8 +144,8 @@ impl TestArgs { let mut project = config.project()?; // install missing dependencies - if install::install_missing_dependencies(&mut config, self.build_args().silent) - && config.auto_detect_remappings + if install::install_missing_dependencies(&mut config, self.build_args().silent) && + config.auto_detect_remappings { // need to re-configure here to also catch additional remappings config = self.load_config(); @@ -374,7 +374,7 @@ impl TestOutcome { pub fn ensure_ok(&self) -> eyre::Result<()> { let failures = self.failures().count(); if self.allow_failure || failures == 0 { - return Ok(()); + return Ok(()) } if !shell::verbosity().is_normal() { @@ -387,7 +387,7 @@ impl TestOutcome { for (suite_name, suite) in self.results.iter() { let failures = suite.failures().count(); if failures == 0 { - continue; + continue } let term = if failures > 1 { "tests" } else { "test" }; @@ -582,7 +582,7 @@ async fn test( // If the test failed, we want to stop processing the rest of the tests if fail_fast && result.status == TestStatus::Failure { - break 'outer; + break 'outer } // We only display logs at level 2 and above @@ -623,12 +623,12 @@ async fn test( // tests At verbosity level 5, we display // all traces for all tests TraceKind::Setup => { - (verbosity >= 5) - || (verbosity == 4 && result.status == TestStatus::Failure) + (verbosity >= 5) || + (verbosity == 4 && result.status == TestStatus::Failure) } TraceKind::Execution => { - verbosity > 3 - || (verbosity == 3 && result.status == TestStatus::Failure) + verbosity > 3 || + (verbosity == 3 && result.status == TestStatus::Failure) } _ => false, }; diff --git a/cli/src/cmd/forge/zksolc.rs b/cli/src/cmd/forge/zksolc.rs index 0377bbddc..df416374c 100644 --- a/cli/src/cmd/forge/zksolc.rs +++ b/cli/src/cmd/forge/zksolc.rs @@ -239,7 +239,7 @@ impl ZkSolc { // Skip this file if it's not in the 'sources' directory or its subdirectories if !is_in_sources_dir { - continue; + continue } // Step 3: Parse JSON Input for each Source @@ -605,9 +605,9 @@ impl ZkSolc { /// self.prepare_compiler_input(contract_path)?; /// ``` /// - /// In this example, the `prepare_compiler_input` function is called with the contract source path. It - /// generates the JSON input for the contract, configures the Solidity compiler, and saves - /// the input to the artifacts directory. + /// In this example, the `prepare_compiler_input` function is called with the contract source + /// path. It generates the JSON input for the contract, configures the Solidity compiler, + /// and saves the input to the artifacts directory. fn prepare_compiler_input(&mut self, contract_path: &PathBuf) -> Result<()> { // Step 1: Configure File Output Selection let mut file_output_selection: FileOutputSelection = BTreeMap::default(); @@ -847,7 +847,7 @@ mod tests { let data = include_str!("testdata/artifacts.json").as_bytes().to_vec(); let mut displayed_warnings = HashSet::new(); let source = "src/Counter.sol".to_owned(); - let result = ZkSolc::handle_output(data, source, &mut displayed_warnings, None); + let result = ZkSolc::handle_output(data, &source, &mut displayed_warnings, None); let artifacts = result.get("Counter").unwrap(); assert_eq!(artifacts.len(), 1); diff --git a/evm/src/executor/backend/mod.rs b/evm/src/executor/backend/mod.rs index 1b179e289..c81fdff02 100644 --- a/evm/src/executor/backend/mod.rs +++ b/evm/src/executor/backend/mod.rs @@ -290,7 +290,7 @@ pub trait DatabaseExt: Database { /// Returns an error if [`Self::has_cheatcode_access`] returns `false` fn ensure_cheatcode_access(&self, account: Address) -> Result<(), NoCheatcodeAccessError> { if !self.has_cheatcode_access(account) { - return Err(NoCheatcodeAccessError(account)); + return Err(NoCheatcodeAccessError(account)) } Ok(()) } @@ -302,7 +302,7 @@ pub trait DatabaseExt: Database { account: Address, ) -> Result<(), NoCheatcodeAccessError> { if self.is_forked_mode() { - return self.ensure_cheatcode_access(account); + return self.ensure_cheatcode_access(account) } Ok(()) } @@ -555,9 +555,8 @@ impl Backend { /// Checks if the test contract associated with this backend failed, See /// [Self::is_failed_test_contract] pub fn is_failed(&self) -> bool { - self.has_snapshot_failure() - || self - .test_contract_address() + self.has_snapshot_failure() || + self.test_contract_address() .map(|addr| self.is_failed_test_contract(addr)) .unwrap_or_default() } @@ -598,7 +597,7 @@ impl Backend { .cloned() .unwrap_or_default() .present_value(); - return value.as_le_bytes()[1] != 0; + return value.as_le_bytes()[1] != 0 } false @@ -612,7 +611,7 @@ impl Backend { U256::from_str_radix(GLOBAL_FAILURE_SLOT, 16).expect("This is a bug.").into(); if let Some(account) = current_state.state.get(&h160_to_b160(CHEATCODE_ADDRESS)) { let value = account.storage.get(&index).cloned().unwrap_or_default().present_value(); - return value == revm::primitives::U256::from(1); + return value == revm::primitives::U256::from(1) } false @@ -714,7 +713,7 @@ impl Backend { all_logs.extend(f.journaled_state.logs.clone()) } }); - return all_logs; + return all_logs } logs @@ -751,7 +750,8 @@ impl Backend { { self.initialize(env); - let result: EVMResult = era_revm::transactions::run_era_transaction(env, self, inspector); + let result: EVMResult = + era_revm::transactions::run_era_transaction(env, self, inspector); Ok(result.unwrap()) } @@ -848,7 +848,7 @@ impl Backend { for tx in full_block.transactions.into_iter() { if tx.hash().eq(&tx_hash) { // found the target transaction - return Ok(Some(tx)); + return Ok(Some(tx)) } trace!(tx=?tx.hash, "committing transaction"); @@ -973,7 +973,7 @@ impl DatabaseExt for Backend { trace!(?id, "select fork"); if self.is_active_fork(id) { // nothing to do - return Ok(()); + return Ok(()) } let fork_id = self.ensure_fork_id(id).cloned()?; @@ -1190,7 +1190,7 @@ impl DatabaseExt for Backend { fn ensure_fork(&self, id: Option) -> eyre::Result { if let Some(id) = id { if self.inner.issued_local_fork_ids.contains_key(&id) { - return Ok(id); + return Ok(id) } eyre::bail!("Requested fork `{}` does not exit", id) } @@ -1216,7 +1216,7 @@ impl DatabaseExt for Backend { if self.inner.forks.len() == 1 { // we only want to provide additional diagnostics here when in multifork mode with > 1 // forks - return None; + return None } if !active_fork.is_contract(callee) && !is_contract_in_state(journaled_state, callee) { @@ -1243,7 +1243,7 @@ impl DatabaseExt for Backend { active: active_id, available_on, }) - }; + } } None } @@ -1416,7 +1416,7 @@ impl Fork { pub fn is_contract(&self, acc: Address) -> bool { if let Ok(Some(acc)) = self.db.basic(h160_to_b160(acc)) { if acc.code_hash != KECCAK_EMPTY { - return true; + return true } } is_contract_in_state(&self.journaled_state, acc) @@ -1736,7 +1736,7 @@ fn merge_db_account_data( acc } else { // Account does not exist - return; + return }; if let Some(code) = active.contracts.get(&acc.info.code_hash).cloned() { diff --git a/evm/src/executor/mod.rs b/evm/src/executor/mod.rs index 3816c8c9f..5809ece85 100644 --- a/evm/src/executor/mod.rs +++ b/evm/src/executor/mod.rs @@ -146,7 +146,7 @@ impl Executor { /// XXXX pub fn deploy_create2_deployer(&mut self) -> eyre::Result<()> { trace!("deploying local create2 deployer"); - return Ok(()); + return Ok(()) /* let create2_deployer_account = self .backend_mut() @@ -480,7 +480,7 @@ impl Executor { state_changeset: None, transactions: None, script_wallets, - }))); + }))) } }; @@ -551,7 +551,7 @@ impl Executor { ) -> Result { if self.backend().has_snapshot_failure() { // a failure occurred in a reverted snapshot, which is considered a failed test - return Ok(should_fail); + return Ok(should_fail) } // Construct a new VM with the state changeset @@ -912,7 +912,7 @@ fn convert_call_result( let reason = decode::decode_revert(result.as_ref(), abi, Some(status)) .unwrap_or_else(|_| format!("{status:?}")); if reason == "SKIPPED" { - return Err(EvmError::SkipError); + return Err(EvmError::SkipError) } Err(EvmError::Execution(Box::new(ExecutionErr { reverted, diff --git a/forge/src/runner.rs b/forge/src/runner.rs index 15468bd98..f489811c1 100644 --- a/forge/src/runner.rs +++ b/forge/src/runner.rs @@ -204,7 +204,7 @@ impl<'a> ContractRunner<'a> { )] .into(), warnings, - ); + ) } let has_invariants = self.contract.functions().any(|func| func.is_invariant_test()); @@ -239,7 +239,7 @@ impl<'a> ContractRunner<'a> { )] .into(), warnings, - ); + ) } let mut test_results = self @@ -435,7 +435,7 @@ impl<'a> ContractRunner<'a> { labeled_addresses, kind: TestKind::Standard(0), ..Default::default() - }]; + }] }; let mut evm = InvariantExecutor::new( @@ -556,7 +556,7 @@ impl<'a> ContractRunner<'a> { labeled_addresses, kind: TestKind::Standard(0), ..Default::default() - }; + } } let kind = TestKind::Fuzz {