Skip to content

Commit 2d5c472

Browse files
committed
save
1 parent dafc553 commit 2d5c472

File tree

18 files changed

+45
-45
lines changed

18 files changed

+45
-45
lines changed

Cargo.toml

+9-5
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,27 @@ explicit_into_iter_loop = "warn"
4646
explicit_iter_loop = "warn"
4747
flat_map_option = "warn"
4848
from_iter_instead_of_collect = "warn"
49-
if_not_else = "warn"
50-
if_then_some_else_none = "warn"
5149
implicit_clone = "warn"
5250
imprecise_flops = "warn"
5351
iter_on_empty_collections = "warn"
54-
iter_on_single_items = "warn"
5552
iter_with_drain = "warn"
5653
iter_without_into_iter = "warn"
5754
large_stack_frames = "warn"
5855
manual-string-new = "warn"
56+
naive_bytecount = "warn"
57+
needless_bitwise_bool = "warn"
58+
needless_continue = "warn"
59+
needless_for_each = "warn"
60+
needless_pass_by_ref_mut = "warn"
61+
nonstandard_macro_braces = "warn"
5962
uninlined-format-args = "warn"
6063
use-self = "warn"
61-
redundant-clone = "warn"
64+
read_zero_byte_vec = "warn"
65+
result_large_err = "allow"
66+
redundant_clone = "warn"
6267
octal-escapes = "allow"
6368
# until <https://github.com/rust-lang/rust-clippy/issues/13885> is fixed
6469
literal-string-with-formatting-args = "allow"
65-
result_large_err = "allow"
6670

6771
[workspace.lints.rust]
6872
rust-2018-idioms = "warn"

crates/anvil/tests/it/fork.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1466,12 +1466,12 @@ async fn test_reset_dev_account_nonce() {
14661466
async fn test_reset_updates_cache_path_when_rpc_url_not_provided() {
14671467
let config: NodeConfig = fork_config();
14681468

1469-
let (mut api, _handle) = spawn(config).await;
1469+
let (api, _handle) = spawn(config).await;
14701470
let info = api.anvil_node_info().await.unwrap();
14711471
let number = info.fork_config.fork_block_number.unwrap();
14721472
assert_eq!(number, BLOCK_NUMBER);
14731473

1474-
async fn get_block_from_cache_path(api: &mut EthApi) -> u64 {
1474+
async fn get_block_from_cache_path(api: &EthApi) -> u64 {
14751475
let db = api.backend.get_db().read().await;
14761476
let cache_path = db.maybe_inner().unwrap().cache().cache_path().unwrap();
14771477
cache_path
@@ -1485,7 +1485,7 @@ async fn test_reset_updates_cache_path_when_rpc_url_not_provided() {
14851485
.expect("must be valid number")
14861486
}
14871487

1488-
assert_eq!(BLOCK_NUMBER, get_block_from_cache_path(&mut api).await);
1488+
assert_eq!(BLOCK_NUMBER, get_block_from_cache_path(&api).await);
14891489

14901490
// Reset to older block without specifying a new rpc url
14911491
api.anvil_reset(Some(Forking {
@@ -1495,7 +1495,7 @@ async fn test_reset_updates_cache_path_when_rpc_url_not_provided() {
14951495
.await
14961496
.unwrap();
14971497

1498-
assert_eq!(BLOCK_NUMBER - 1_000_000, get_block_from_cache_path(&mut api).await);
1498+
assert_eq!(BLOCK_NUMBER - 1_000_000, get_block_from_cache_path(&api).await);
14991499
}
15001500

15011501
#[tokio::test(flavor = "multi_thread")]

crates/cheatcodes/src/evm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,7 @@ fn genesis_account(account: &Account) -> GenesisAccount {
11801180
}
11811181

11821182
/// Helper function to returns state diffs recorded for each changed account.
1183-
fn get_recorded_state_diffs(state: &mut Cheatcodes) -> BTreeMap<Address, AccountStateDiffs> {
1183+
fn get_recorded_state_diffs(state: &Cheatcodes) -> BTreeMap<Address, AccountStateDiffs> {
11841184
let mut state_diffs: BTreeMap<Address, AccountStateDiffs> = BTreeMap::default();
11851185
if let Some(records) = &state.recorded_account_diffs_stack {
11861186
records

crates/cheatcodes/src/inspector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1777,7 +1777,7 @@ impl Cheatcodes {
17771777
}
17781778

17791779
#[cold]
1780-
fn meter_gas_record(&mut self, interpreter: &mut Interpreter, ecx: Ecx) {
1780+
fn meter_gas_record(&mut self, interpreter: &Interpreter, ecx: Ecx) {
17811781
if matches!(interpreter.instruction_result, InstructionResult::Continue) {
17821782
self.gas_metering.gas_records.iter_mut().for_each(|record| {
17831783
if ecx.journaled_state.depth() == record.depth {

crates/cli/src/opts/dependency.rs

+8-12
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ mod tests {
160160

161161
#[test]
162162
fn parses_dependencies() {
163-
[
163+
for (input, expected_path, expected_tag, expected_alias) in &[
164164
("gakonst/lootloose", "https://github.com/gakonst/lootloose", None, None),
165165
("github.com/gakonst/lootloose", "https://github.com/gakonst/lootloose", None, None),
166166
(
@@ -242,15 +242,13 @@ mod tests {
242242
Some("v1"),
243243
Some("loot"),
244244
),
245-
]
246-
.iter()
247-
.for_each(|(input, expected_path, expected_tag, expected_alias)| {
245+
] {
248246
let dep = Dependency::from_str(input).unwrap();
249247
assert_eq!(dep.url, Some(expected_path.to_string()));
250248
assert_eq!(dep.tag, expected_tag.map(ToString::to_string));
251249
assert_eq!(dep.name, "lootloose");
252250
assert_eq!(dep.alias, expected_alias.map(ToString::to_string));
253-
});
251+
}
254252
}
255253

256254
#[test]
@@ -270,28 +268,26 @@ mod tests {
270268

271269
#[test]
272270
fn parses_contract_info() {
273-
[
271+
for (input, expected_path, expected_name) in &[
274272
(
275273
"src/contracts/Contracts.sol:Contract",
276274
Some("src/contracts/Contracts.sol"),
277275
"Contract",
278276
),
279277
("Contract", None, "Contract"),
280-
]
281-
.iter()
282-
.for_each(|(input, expected_path, expected_name)| {
278+
] {
283279
let contract = ContractInfo::from_str(input).unwrap();
284280
assert_eq!(contract.path, expected_path.map(ToString::to_string));
285281
assert_eq!(contract.name, expected_name.to_string());
286-
});
282+
}
287283
}
288284

289285
#[test]
290286
fn contract_info_should_reject_without_name() {
291-
["src/contracts/", "src/contracts/Contracts.sol"].iter().for_each(|input| {
287+
for input in &["src/contracts/", "src/contracts/Contracts.sol"] {
292288
let contract = ContractInfo::from_str(input);
293289
assert!(contract.is_err())
294-
});
290+
}
295291
}
296292

297293
#[test]

crates/cli/src/utils/cmd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,12 @@ pub fn cache_local_signatures(output: &ProjectCompileOutput, cache_path: PathBuf
455455
}
456456
// External libraries doesn't have functions included in abi, but `methodIdentifiers`.
457457
if let Some(method_identifiers) = &artifact.method_identifiers {
458-
method_identifiers.iter().for_each(|(signature, selector)| {
458+
for (signature, selector) in method_identifiers {
459459
cached_signatures
460460
.functions
461461
.entry(format!("0x{selector}"))
462462
.or_insert(signature.to_string());
463-
});
463+
}
464464
}
465465
}
466466
});

crates/common/fmt/src/console.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ impl<'a> Parser<'a> {
127127
self.input[start..end].parse().ok()
128128
}
129129

130-
fn current_pos(&mut self) -> usize {
130+
fn current_pos(&self) -> usize {
131131
self.peek().map(|(n, _)| n).unwrap_or(self.input.len())
132132
}
133133

134-
fn peek(&mut self) -> Option<(usize, char)> {
134+
fn peek(&self) -> Option<(usize, char)> {
135135
self.peek_n(0)
136136
}
137137

138-
fn peek_n(&mut self, n: usize) -> Option<(usize, char)> {
138+
fn peek_n(&self, n: usize) -> Option<(usize, char)> {
139139
self.chars.clone().nth(n)
140140
}
141141
}

crates/doc/src/parser/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,18 @@ impl Parser {
9999
}
100100

101101
/// Create new [ParseItem] with comments and formatted code.
102-
fn new_item(&mut self, source: ParseSource, loc_start: usize) -> ParserResult<ParseItem> {
102+
fn new_item(&self, source: ParseSource, loc_start: usize) -> ParserResult<ParseItem> {
103103
let docs = self.parse_docs(loc_start)?;
104104
ParseItem::new(source).with_comments(docs).with_code(&self.source, self.fmt.clone())
105105
}
106106

107107
/// Parse the doc comments from the current start location.
108-
fn parse_docs(&mut self, end: usize) -> ParserResult<Comments> {
108+
fn parse_docs(&self, end: usize) -> ParserResult<Comments> {
109109
self.parse_docs_range(self.context.doc_start_loc, end)
110110
}
111111

112112
/// Parse doc comments from the within specified range.
113-
fn parse_docs_range(&mut self, start: usize, end: usize) -> ParserResult<Comments> {
113+
fn parse_docs_range(&self, start: usize, end: usize) -> ParserResult<Comments> {
114114
let mut res = vec![];
115115
for comment in parse_doccomments(&self.comments, start, end) {
116116
match comment {

crates/evm/traces/src/folded_stack_trace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl FoldedStackTraceBuilder {
179179

180180
/// Internal method to build the folded stack trace without subtracting gas consumed by
181181
/// the children function calls.
182-
fn build_without_subtraction(&mut self) -> Vec<String> {
182+
fn build_without_subtraction(&self) -> Vec<String> {
183183
let mut lines = Vec::new();
184184
for TraceEntry { names, gas } in &self.traces {
185185
lines.push(format!("{} {}", names.join(";"), gas));

crates/fmt/src/comments.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl<'a> CommentStateCharIndices<'a> {
338338
}
339339

340340
#[inline]
341-
pub fn peek(&mut self) -> Option<(usize, char)> {
341+
pub fn peek(&self) -> Option<(usize, char)> {
342342
self.iter.clone().next()
343343
}
344344
}

crates/fmt/src/formatter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl<'a, W: Write> Formatter<'a, W> {
323323
/// lookup whether there was a newline introduced in `[start_from, end_at]` range
324324
/// where `end_at` is the start of the block.
325325
fn should_attempt_block_single_line(
326-
&mut self,
326+
&self,
327327
stmt: &mut Statement,
328328
start_from: usize,
329329
) -> bool {

crates/forge/src/cmd/clone.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ mod tests {
645645
stripped_creation_code: &str,
646646
) {
647647
compiled.compiled_contracts_by_compiler_version().iter().for_each(|(_, contracts)| {
648-
contracts.iter().for_each(|(name, contract)| {
648+
for (name, contract) in contracts {
649649
if name == contract_name {
650650
let compiled_creation_code =
651651
contract.bin_ref().expect("creation code not found");
@@ -655,7 +655,7 @@ mod tests {
655655
"inconsistent creation code"
656656
);
657657
}
658-
});
658+
}
659659
});
660660
}
661661

crates/forge/src/cmd/test/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ impl TestArgs {
472472
// Run tests in a non-streaming fashion and collect results for serialization.
473473
if !self.gas_report && !self.summary && shell::is_json() {
474474
let mut results = runner.test_collect(filter);
475-
results.values_mut().for_each(|suite_result| {
475+
for suite_result in results.values_mut() {
476476
for test_result in suite_result.test_results.values_mut() {
477477
if verbosity >= 2 {
478478
// Decode logs at level 2 and above.
@@ -482,7 +482,7 @@ impl TestArgs {
482482
test_result.logs = vec![];
483483
}
484484
}
485-
});
485+
}
486486
sh_println!("{}", serde_json::to_string(&results)?)?;
487487
return Ok(TestOutcome::new(results, self.allow_failure));
488488
}

crates/forge/src/multi_runner.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ impl MultiContractRunner {
211211

212212
tests_progress.inner.lock().clear();
213213

214-
results.iter().for_each(|result| {
214+
for result in &results {
215215
let _ = tx.send(result.to_owned());
216-
});
216+
}
217217
} else {
218218
contracts.par_iter().for_each(|&(id, contract)| {
219219
let _guard = tokio_handle.enter();

crates/forge/src/progress.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl TestsProgressState {
6161
/// phase. Test progress is placed under test suite progress entry so all tests within suite
6262
/// are grouped.
6363
pub fn start_fuzz_progress(
64-
&mut self,
64+
&self,
6565
suite_name: &str,
6666
test_name: &String,
6767
runs: u32,
@@ -84,7 +84,7 @@ impl TestsProgressState {
8484
}
8585

8686
/// Removes overall test progress.
87-
pub fn clear(&mut self) {
87+
pub fn clear(&self) {
8888
self.multi.clear().unwrap();
8989
}
9090
}

crates/forge/src/runner.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<'a> ContractRunner<'a> {
241241
/// `function fixture_owner() public returns (address[] memory){}`
242242
/// returns an array of addresses to be used for fuzzing `owner` named parameter in scope of the
243243
/// current test.
244-
fn fuzz_fixtures(&mut self, address: Address) -> FuzzFixtures {
244+
fn fuzz_fixtures(&self, address: Address) -> FuzzFixtures {
245245
let mut fixtures = HashMap::default();
246246
let fixture_functions = self.contract.abi.functions().filter(|func| func.is_fixture());
247247
for func in fixture_functions {

crates/script/src/progress.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl SequenceProgressState {
121121
}
122122

123123
/// Sets status for the current sequence progress.
124-
pub fn set_status(&mut self, status: &str) {
124+
pub fn set_status(&self, status: &str) {
125125
self.top_spinner.set_message(format!(" | {status}"));
126126
}
127127

crates/verify/src/etherscan/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl EtherscanVerificationProvider {
387387
/// match provided creation code with local bytecode of the target contract.
388388
/// If bytecode match, returns latest bytes of on-chain creation code as constructor arguments.
389389
async fn guess_constructor_args(
390-
&mut self,
390+
&self,
391391
args: &VerifyArgs,
392392
context: &VerificationContext,
393393
) -> Result<String> {

0 commit comments

Comments
 (0)