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

Lines changed: 9 additions & 5 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 8 additions & 12 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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
}

0 commit comments

Comments
 (0)