Skip to content

Commit 62f4187

Browse files
committed
Auto merge of #7546 - mgeier:patch-1, r=giraffate
similar_names: allow "iter" and "item" changelog: [`similar_names`] no longer complains about `iter` and `item` being too similar
2 parents e62a6ca + f7784ef commit 62f4187

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

clippy_lints/src/non_expressive_names.rs

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const ALLOWED_TO_BE_SIMILAR: &[&[&str]] = &[
126126
&["qpath", "path"],
127127
&["lit", "lint"],
128128
&["wparam", "lparam"],
129+
&["iter", "item"],
129130
];
130131

131132
struct SimilarNamesNameVisitor<'a, 'tcx, 'b>(&'b mut SimilarNamesLocalVisitor<'a, 'tcx>);

tests/ui/similar_names.rs

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ fn main() {
7676
// names often used in win32 code (for example WindowProc)
7777
let wparam: i32;
7878
let lparam: i32;
79+
80+
let iter: i32;
81+
let item: i32;
7982
}
8083

8184
fn foo() {

tests/ui/similar_names.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ LL | let parser: i32;
7272
| ^^^^^^
7373

7474
error: binding's name is too similar to existing binding
75-
--> $DIR/similar_names.rs:85:16
75+
--> $DIR/similar_names.rs:88:16
7676
|
7777
LL | bpple: sprang,
7878
| ^^^^^^
7979
|
8080
note: existing binding defined here
81-
--> $DIR/similar_names.rs:84:16
81+
--> $DIR/similar_names.rs:87:16
8282
|
8383
LL | apple: spring,
8484
| ^^^^^^

0 commit comments

Comments
 (0)