Skip to content

Commit

Permalink
Remove shadow allows
Browse files Browse the repository at this point in the history
  • Loading branch information
camsteffen committed Sep 30, 2021
1 parent 8c0e4d5 commit a17359c
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 141 deletions.
1 change: 0 additions & 1 deletion clippy_utils/src/lib.rs
Expand Up @@ -510,7 +510,6 @@ pub fn path_to_local_id(expr: &Expr<'_>, id: HirId) -> bool {
}

/// Gets the definition associated to a path.
#[allow(clippy::shadow_unrelated)] // false positive #6563
pub fn path_to_res(cx: &LateContext<'_>, path: &[&str]) -> Res {
macro_rules! try_res {
($e:expr) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/approx_const.rs
@@ -1,5 +1,5 @@
#[warn(clippy::approx_constant)]
#[allow(unused, clippy::shadow_unrelated, clippy::similar_names)]
#[allow(clippy::similar_names)]
fn main() {
let my_e = 2.7182;
let almost_e = 2.718;
Expand Down
7 changes: 1 addition & 6 deletions tests/ui/for_loop_fixable.fixed
Expand Up @@ -23,12 +23,7 @@ impl Unrelated {
clippy::iter_next_loop,
clippy::for_kv_map
)]
#[allow(
clippy::linkedlist,
clippy::shadow_unrelated,
clippy::unnecessary_mut_passed,
clippy::similar_names
)]
#[allow(clippy::linkedlist, clippy::unnecessary_mut_passed, clippy::similar_names)]
#[allow(unused_variables)]
fn main() {
let mut vec = vec![1, 2, 3, 4];
Expand Down
7 changes: 1 addition & 6 deletions tests/ui/for_loop_fixable.rs
Expand Up @@ -23,12 +23,7 @@ impl Unrelated {
clippy::iter_next_loop,
clippy::for_kv_map
)]
#[allow(
clippy::linkedlist,
clippy::shadow_unrelated,
clippy::unnecessary_mut_passed,
clippy::similar_names
)]
#[allow(clippy::linkedlist, clippy::unnecessary_mut_passed, clippy::similar_names)]
#[allow(unused_variables)]
fn main() {
let mut vec = vec![1, 2, 3, 4];
Expand Down
30 changes: 15 additions & 15 deletions tests/ui/for_loop_fixable.stderr
@@ -1,93 +1,93 @@
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> $DIR/for_loop_fixable.rs:43:15
--> $DIR/for_loop_fixable.rs:38:15
|
LL | for _v in vec.iter() {}
| ^^^^^^^^^^ help: to write this more concisely, try: `&vec`
|
= note: `-D clippy::explicit-iter-loop` implied by `-D warnings`

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

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

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

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

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

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

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

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

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

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

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

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

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

error: it is more concise to loop over containers instead of using explicit iteration methods
--> $DIR/for_loop_fixable.rs:277:18
--> $DIR/for_loop_fixable.rs:272:18
|
LL | for _ in r.into_iter() {}
| ^^^^^^^^^^^^^ help: to write this more concisely, try: `r`
Expand Down
9 changes: 1 addition & 8 deletions tests/ui/for_loop_unfixable.rs
Expand Up @@ -7,14 +7,7 @@
clippy::iter_next_loop,
clippy::for_kv_map
)]
#[allow(
clippy::linkedlist,
clippy::shadow_unrelated,
clippy::unnecessary_mut_passed,
clippy::similar_names,
unused,
dead_code
)]
#[allow(clippy::linkedlist, clippy::unnecessary_mut_passed, clippy::similar_names)]
fn main() {
let vec = vec![1, 2, 3, 4];

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/for_loop_unfixable.stderr
@@ -1,5 +1,5 @@
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
--> $DIR/for_loop_unfixable.rs:21:15
--> $DIR/for_loop_unfixable.rs:14:15
|
LL | for _v in vec.iter().next() {}
| ^^^^^^^^^^^^^^^^^
Expand Down
9 changes: 1 addition & 8 deletions tests/ui/integer_arithmetic.rs
@@ -1,12 +1,5 @@
#![warn(clippy::integer_arithmetic, clippy::float_arithmetic)]
#![allow(
unused,
clippy::shadow_reuse,
clippy::shadow_unrelated,
clippy::no_effect,
clippy::unnecessary_operation,
clippy::op_ref
)]
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::op_ref)]

#[rustfmt::skip]
fn main() {
Expand Down
54 changes: 27 additions & 27 deletions tests/ui/integer_arithmetic.stderr
@@ -1,166 +1,166 @@
error: this operation will panic at runtime
--> $DIR/integer_arithmetic.rs:37:5
--> $DIR/integer_arithmetic.rs:30:5
|
LL | i /= 0;
| ^^^^^^ attempt to divide `_` by zero
|
= note: `#[deny(unconditional_panic)]` on by default

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

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

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:17:5
--> $DIR/integer_arithmetic.rs:10:5
|
LL | i * 2;
| ^^^^^

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

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:20:5
--> $DIR/integer_arithmetic.rs:13:5
|
LL | i - 2 + 2 - i;
| ^^^^^^^^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:21:5
--> $DIR/integer_arithmetic.rs:14:5
|
LL | -i;
| ^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:22:5
--> $DIR/integer_arithmetic.rs:15:5
|
LL | i >> 1;
| ^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:23:5
--> $DIR/integer_arithmetic.rs:16:5
|
LL | i << 1;
| ^^^^^^

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

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:34:5
--> $DIR/integer_arithmetic.rs:27:5
|
LL | i -= 1;
| ^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:35:5
--> $DIR/integer_arithmetic.rs:28:5
|
LL | i *= 2;
| ^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:38:11
--> $DIR/integer_arithmetic.rs:31:11
|
LL | i /= -1;
| ^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:39:5
--> $DIR/integer_arithmetic.rs:32:5
|
LL | i /= var1;
| ^^^^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:40:5
--> $DIR/integer_arithmetic.rs:33:5
|
LL | i /= var2;
| ^^^^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:43:11
--> $DIR/integer_arithmetic.rs:36:11
|
LL | i %= -1;
| ^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:44:5
--> $DIR/integer_arithmetic.rs:37:5
|
LL | i %= var1;
| ^^^^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:45:5
--> $DIR/integer_arithmetic.rs:38:5
|
LL | i %= var2;
| ^^^^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:46:5
--> $DIR/integer_arithmetic.rs:39:5
|
LL | i <<= 3;
| ^^^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:47:5
--> $DIR/integer_arithmetic.rs:40:5
|
LL | i >>= 2;
| ^^^^^^^

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

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

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

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:96:5
--> $DIR/integer_arithmetic.rs:89:5
|
LL | a + x
| ^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:100:5
--> $DIR/integer_arithmetic.rs:93:5
|
LL | x + y
| ^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:104:5
--> $DIR/integer_arithmetic.rs:97:5
|
LL | x + y
| ^^^^^

error: integer arithmetic detected
--> $DIR/integer_arithmetic.rs:108:5
--> $DIR/integer_arithmetic.rs:101:5
|
LL | (&x + &y)
| ^^^^^^^^^
Expand Down
9 changes: 1 addition & 8 deletions tests/ui/modulo_arithmetic_float.rs
@@ -1,12 +1,5 @@
#![warn(clippy::modulo_arithmetic)]
#![allow(
unused,
clippy::shadow_reuse,
clippy::shadow_unrelated,
clippy::no_effect,
clippy::unnecessary_operation,
clippy::modulo_one
)]
#![allow(clippy::no_effect, clippy::unnecessary_operation, clippy::modulo_one)]

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

0 comments on commit a17359c

Please sign in to comment.