Skip to content

Commit a17359c

Browse files
committed
Remove shadow allows
1 parent 8c0e4d5 commit a17359c

15 files changed

+95
-141
lines changed

clippy_utils/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@ pub fn path_to_local_id(expr: &Expr<'_>, id: HirId) -> bool {
510510
}
511511

512512
/// Gets the definition associated to a path.
513-
#[allow(clippy::shadow_unrelated)] // false positive #6563
514513
pub fn path_to_res(cx: &LateContext<'_>, path: &[&str]) -> Res {
515514
macro_rules! try_res {
516515
($e:expr) => {

tests/ui/approx_const.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[warn(clippy::approx_constant)]
2-
#[allow(unused, clippy::shadow_unrelated, clippy::similar_names)]
2+
#[allow(clippy::similar_names)]
33
fn main() {
44
let my_e = 2.7182;
55
let almost_e = 2.718;

tests/ui/for_loop_fixable.fixed

+1-6
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ impl Unrelated {
2323
clippy::iter_next_loop,
2424
clippy::for_kv_map
2525
)]
26-
#[allow(
27-
clippy::linkedlist,
28-
clippy::shadow_unrelated,
29-
clippy::unnecessary_mut_passed,
30-
clippy::similar_names
31-
)]
26+
#[allow(clippy::linkedlist, clippy::unnecessary_mut_passed, clippy::similar_names)]
3227
#[allow(unused_variables)]
3328
fn main() {
3429
let mut vec = vec![1, 2, 3, 4];

tests/ui/for_loop_fixable.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ impl Unrelated {
2323
clippy::iter_next_loop,
2424
clippy::for_kv_map
2525
)]
26-
#[allow(
27-
clippy::linkedlist,
28-
clippy::shadow_unrelated,
29-
clippy::unnecessary_mut_passed,
30-
clippy::similar_names
31-
)]
26+
#[allow(clippy::linkedlist, clippy::unnecessary_mut_passed, clippy::similar_names)]
3227
#[allow(unused_variables)]
3328
fn main() {
3429
let mut vec = vec![1, 2, 3, 4];

tests/ui/for_loop_fixable.stderr

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,93 @@
11
error: it is more concise to loop over references to containers instead of using explicit iteration methods
2-
--> $DIR/for_loop_fixable.rs:43:15
2+
--> $DIR/for_loop_fixable.rs:38:15
33
|
44
LL | for _v in vec.iter() {}
55
| ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
66
|
77
= note: `-D clippy::explicit-iter-loop` implied by `-D warnings`
88

99
error: it is more concise to loop over references to containers instead of using explicit iteration methods
10-
--> $DIR/for_loop_fixable.rs:45:15
10+
--> $DIR/for_loop_fixable.rs:40:15
1111
|
1212
LL | for _v in vec.iter_mut() {}
1313
| ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut vec`
1414

1515
error: it is more concise to loop over containers instead of using explicit iteration methods
16-
--> $DIR/for_loop_fixable.rs:48:15
16+
--> $DIR/for_loop_fixable.rs:43:15
1717
|
1818
LL | for _v in out_vec.into_iter() {}
1919
| ^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `out_vec`
2020
|
2121
= note: `-D clippy::explicit-into-iter-loop` implied by `-D warnings`
2222

2323
error: it is more concise to loop over references to containers instead of using explicit iteration methods
24-
--> $DIR/for_loop_fixable.rs:53:15
24+
--> $DIR/for_loop_fixable.rs:48:15
2525
|
2626
LL | for _v in [1, 2, 3].iter() {}
2727
| ^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[1, 2, 3]`
2828

2929
error: it is more concise to loop over references to containers instead of using explicit iteration methods
30-
--> $DIR/for_loop_fixable.rs:57:15
30+
--> $DIR/for_loop_fixable.rs:52:15
3131
|
3232
LL | for _v in [0; 32].iter() {}
3333
| ^^^^^^^^^^^^^^ help: to write this more concisely, try: `&[0; 32]`
3434

3535
error: it is more concise to loop over references to containers instead of using explicit iteration methods
36-
--> $DIR/for_loop_fixable.rs:62:15
36+
--> $DIR/for_loop_fixable.rs:57:15
3737
|
3838
LL | for _v in ll.iter() {}
3939
| ^^^^^^^^^ help: to write this more concisely, try: `&ll`
4040

4141
error: it is more concise to loop over references to containers instead of using explicit iteration methods
42-
--> $DIR/for_loop_fixable.rs:65:15
42+
--> $DIR/for_loop_fixable.rs:60:15
4343
|
4444
LL | for _v in vd.iter() {}
4545
| ^^^^^^^^^ help: to write this more concisely, try: `&vd`
4646

4747
error: it is more concise to loop over references to containers instead of using explicit iteration methods
48-
--> $DIR/for_loop_fixable.rs:68:15
48+
--> $DIR/for_loop_fixable.rs:63:15
4949
|
5050
LL | for _v in bh.iter() {}
5151
| ^^^^^^^^^ help: to write this more concisely, try: `&bh`
5252

5353
error: it is more concise to loop over references to containers instead of using explicit iteration methods
54-
--> $DIR/for_loop_fixable.rs:71:15
54+
--> $DIR/for_loop_fixable.rs:66:15
5555
|
5656
LL | for _v in hm.iter() {}
5757
| ^^^^^^^^^ help: to write this more concisely, try: `&hm`
5858

5959
error: it is more concise to loop over references to containers instead of using explicit iteration methods
60-
--> $DIR/for_loop_fixable.rs:74:15
60+
--> $DIR/for_loop_fixable.rs:69:15
6161
|
6262
LL | for _v in bt.iter() {}
6363
| ^^^^^^^^^ help: to write this more concisely, try: `&bt`
6464

6565
error: it is more concise to loop over references to containers instead of using explicit iteration methods
66-
--> $DIR/for_loop_fixable.rs:77:15
66+
--> $DIR/for_loop_fixable.rs:72:15
6767
|
6868
LL | for _v in hs.iter() {}
6969
| ^^^^^^^^^ help: to write this more concisely, try: `&hs`
7070

7171
error: it is more concise to loop over references to containers instead of using explicit iteration methods
72-
--> $DIR/for_loop_fixable.rs:80:15
72+
--> $DIR/for_loop_fixable.rs:75:15
7373
|
7474
LL | for _v in bs.iter() {}
7575
| ^^^^^^^^^ help: to write this more concisely, try: `&bs`
7676

7777
error: it is more concise to loop over containers instead of using explicit iteration methods
78-
--> $DIR/for_loop_fixable.rs:255:18
78+
--> $DIR/for_loop_fixable.rs:250:18
7979
|
8080
LL | for i in iterator.into_iter() {
8181
| ^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `iterator`
8282

8383
error: it is more concise to loop over references to containers instead of using explicit iteration methods
84-
--> $DIR/for_loop_fixable.rs:275:18
84+
--> $DIR/for_loop_fixable.rs:270:18
8585
|
8686
LL | for _ in t.into_iter() {}
8787
| ^^^^^^^^^^^^^ help: to write this more concisely, try: `&t`
8888

8989
error: it is more concise to loop over containers instead of using explicit iteration methods
90-
--> $DIR/for_loop_fixable.rs:277:18
90+
--> $DIR/for_loop_fixable.rs:272:18
9191
|
9292
LL | for _ in r.into_iter() {}
9393
| ^^^^^^^^^^^^^ help: to write this more concisely, try: `r`

tests/ui/for_loop_unfixable.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@
77
clippy::iter_next_loop,
88
clippy::for_kv_map
99
)]
10-
#[allow(
11-
clippy::linkedlist,
12-
clippy::shadow_unrelated,
13-
clippy::unnecessary_mut_passed,
14-
clippy::similar_names,
15-
unused,
16-
dead_code
17-
)]
10+
#[allow(clippy::linkedlist, clippy::unnecessary_mut_passed, clippy::similar_names)]
1811
fn main() {
1912
let vec = vec![1, 2, 3, 4];
2013

tests/ui/for_loop_unfixable.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
2-
--> $DIR/for_loop_unfixable.rs:21:15
2+
--> $DIR/for_loop_unfixable.rs:14:15
33
|
44
LL | for _v in vec.iter().next() {}
55
| ^^^^^^^^^^^^^^^^^

tests/ui/integer_arithmetic.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
#![warn(clippy::integer_arithmetic, clippy::float_arithmetic)]
2-
#![allow(
3-
unused,
4-
clippy::shadow_reuse,
5-
clippy::shadow_unrelated,
6-
clippy::no_effect,
7-
clippy::unnecessary_operation,
8-
clippy::op_ref
9-
)]
2+
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::op_ref)]
103

114
#[rustfmt::skip]
125
fn main() {

tests/ui/integer_arithmetic.stderr

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,166 +1,166 @@
11
error: this operation will panic at runtime
2-
--> $DIR/integer_arithmetic.rs:37:5
2+
--> $DIR/integer_arithmetic.rs:30:5
33
|
44
LL | i /= 0;
55
| ^^^^^^ attempt to divide `_` by zero
66
|
77
= note: `#[deny(unconditional_panic)]` on by default
88

99
error: this operation will panic at runtime
10-
--> $DIR/integer_arithmetic.rs:42:5
10+
--> $DIR/integer_arithmetic.rs:35:5
1111
|
1212
LL | i %= 0;
1313
| ^^^^^^ attempt to calculate the remainder of `_` with a divisor of zero
1414

1515
error: integer arithmetic detected
16-
--> $DIR/integer_arithmetic.rs:16:5
16+
--> $DIR/integer_arithmetic.rs:9:5
1717
|
1818
LL | 1 + i;
1919
| ^^^^^
2020
|
2121
= note: `-D clippy::integer-arithmetic` implied by `-D warnings`
2222

2323
error: integer arithmetic detected
24-
--> $DIR/integer_arithmetic.rs:17:5
24+
--> $DIR/integer_arithmetic.rs:10:5
2525
|
2626
LL | i * 2;
2727
| ^^^^^
2828

2929
error: integer arithmetic detected
30-
--> $DIR/integer_arithmetic.rs:18:5
30+
--> $DIR/integer_arithmetic.rs:11:5
3131
|
3232
LL | / 1 %
3333
LL | | i / 2; // no error, this is part of the expression in the preceding line
3434
| |_____^
3535

3636
error: integer arithmetic detected
37-
--> $DIR/integer_arithmetic.rs:20:5
37+
--> $DIR/integer_arithmetic.rs:13:5
3838
|
3939
LL | i - 2 + 2 - i;
4040
| ^^^^^^^^^^^^^
4141

4242
error: integer arithmetic detected
43-
--> $DIR/integer_arithmetic.rs:21:5
43+
--> $DIR/integer_arithmetic.rs:14:5
4444
|
4545
LL | -i;
4646
| ^^
4747

4848
error: integer arithmetic detected
49-
--> $DIR/integer_arithmetic.rs:22:5
49+
--> $DIR/integer_arithmetic.rs:15:5
5050
|
5151
LL | i >> 1;
5252
| ^^^^^^
5353

5454
error: integer arithmetic detected
55-
--> $DIR/integer_arithmetic.rs:23:5
55+
--> $DIR/integer_arithmetic.rs:16:5
5656
|
5757
LL | i << 1;
5858
| ^^^^^^
5959

6060
error: integer arithmetic detected
61-
--> $DIR/integer_arithmetic.rs:33:5
61+
--> $DIR/integer_arithmetic.rs:26:5
6262
|
6363
LL | i += 1;
6464
| ^^^^^^
6565

6666
error: integer arithmetic detected
67-
--> $DIR/integer_arithmetic.rs:34:5
67+
--> $DIR/integer_arithmetic.rs:27:5
6868
|
6969
LL | i -= 1;
7070
| ^^^^^^
7171

7272
error: integer arithmetic detected
73-
--> $DIR/integer_arithmetic.rs:35:5
73+
--> $DIR/integer_arithmetic.rs:28:5
7474
|
7575
LL | i *= 2;
7676
| ^^^^^^
7777

7878
error: integer arithmetic detected
79-
--> $DIR/integer_arithmetic.rs:38:11
79+
--> $DIR/integer_arithmetic.rs:31:11
8080
|
8181
LL | i /= -1;
8282
| ^
8383

8484
error: integer arithmetic detected
85-
--> $DIR/integer_arithmetic.rs:39:5
85+
--> $DIR/integer_arithmetic.rs:32:5
8686
|
8787
LL | i /= var1;
8888
| ^^^^^^^^^
8989

9090
error: integer arithmetic detected
91-
--> $DIR/integer_arithmetic.rs:40:5
91+
--> $DIR/integer_arithmetic.rs:33:5
9292
|
9393
LL | i /= var2;
9494
| ^^^^^^^^^
9595

9696
error: integer arithmetic detected
97-
--> $DIR/integer_arithmetic.rs:43:11
97+
--> $DIR/integer_arithmetic.rs:36:11
9898
|
9999
LL | i %= -1;
100100
| ^
101101

102102
error: integer arithmetic detected
103-
--> $DIR/integer_arithmetic.rs:44:5
103+
--> $DIR/integer_arithmetic.rs:37:5
104104
|
105105
LL | i %= var1;
106106
| ^^^^^^^^^
107107

108108
error: integer arithmetic detected
109-
--> $DIR/integer_arithmetic.rs:45:5
109+
--> $DIR/integer_arithmetic.rs:38:5
110110
|
111111
LL | i %= var2;
112112
| ^^^^^^^^^
113113

114114
error: integer arithmetic detected
115-
--> $DIR/integer_arithmetic.rs:46:5
115+
--> $DIR/integer_arithmetic.rs:39:5
116116
|
117117
LL | i <<= 3;
118118
| ^^^^^^^
119119

120120
error: integer arithmetic detected
121-
--> $DIR/integer_arithmetic.rs:47:5
121+
--> $DIR/integer_arithmetic.rs:40:5
122122
|
123123
LL | i >>= 2;
124124
| ^^^^^^^
125125

126126
error: integer arithmetic detected
127-
--> $DIR/integer_arithmetic.rs:89:5
127+
--> $DIR/integer_arithmetic.rs:82:5
128128
|
129129
LL | 3 + &1;
130130
| ^^^^^^
131131

132132
error: integer arithmetic detected
133-
--> $DIR/integer_arithmetic.rs:90:5
133+
--> $DIR/integer_arithmetic.rs:83:5
134134
|
135135
LL | &3 + 1;
136136
| ^^^^^^
137137

138138
error: integer arithmetic detected
139-
--> $DIR/integer_arithmetic.rs:91:5
139+
--> $DIR/integer_arithmetic.rs:84:5
140140
|
141141
LL | &3 + &1;
142142
| ^^^^^^^
143143

144144
error: integer arithmetic detected
145-
--> $DIR/integer_arithmetic.rs:96:5
145+
--> $DIR/integer_arithmetic.rs:89:5
146146
|
147147
LL | a + x
148148
| ^^^^^
149149

150150
error: integer arithmetic detected
151-
--> $DIR/integer_arithmetic.rs:100:5
151+
--> $DIR/integer_arithmetic.rs:93:5
152152
|
153153
LL | x + y
154154
| ^^^^^
155155

156156
error: integer arithmetic detected
157-
--> $DIR/integer_arithmetic.rs:104:5
157+
--> $DIR/integer_arithmetic.rs:97:5
158158
|
159159
LL | x + y
160160
| ^^^^^
161161

162162
error: integer arithmetic detected
163-
--> $DIR/integer_arithmetic.rs:108:5
163+
--> $DIR/integer_arithmetic.rs:101:5
164164
|
165165
LL | (&x + &y)
166166
| ^^^^^^^^^

tests/ui/modulo_arithmetic_float.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
#![warn(clippy::modulo_arithmetic)]
2-
#![allow(
3-
unused,
4-
clippy::shadow_reuse,
5-
clippy::shadow_unrelated,
6-
clippy::no_effect,
7-
clippy::unnecessary_operation,
8-
clippy::modulo_one
9-
)]
2+
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::modulo_one)]
103

114
fn main() {
125
// Lint when both sides are const and of the opposite sign

0 commit comments

Comments
 (0)