Remove shadow allows

This commit is contained in:
Cameron Steffen 2021-09-27 17:19:33 -05:00
parent 8c0e4d5ccf
commit a17359c696
15 changed files with 95 additions and 141 deletions

View file

@ -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) => {

View file

@ -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;

View file

@ -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];

View file

@ -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];

View file

@ -1,5 +1,5 @@
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`
@ -7,13 +7,13 @@ LL | for _v in vec.iter() {}
= 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`
@ -21,73 +21,73 @@ LL | for _v in out_vec.into_iter() {}
= 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`

View file

@ -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];

View file

@ -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() {}
| ^^^^^^^^^^^^^^^^^

View file

@ -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() {

View file

@ -1,5 +1,5 @@
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
@ -7,13 +7,13 @@ LL | i /= 0;
= 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;
| ^^^^^
@ -21,146 +21,146 @@ 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)
| ^^^^^^^^^

View file

@ -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

View file

@ -1,5 +1,5 @@
error: you are using modulo operator on constants with different signs: `-1.600 % 2.100`
--> $DIR/modulo_arithmetic_float.rs:13:5
--> $DIR/modulo_arithmetic_float.rs:6:5
|
LL | -1.6 % 2.1;
| ^^^^^^^^^^
@ -8,7 +8,7 @@ LL | -1.6 % 2.1;
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on constants with different signs: `1.600 % -2.100`
--> $DIR/modulo_arithmetic_float.rs:14:5
--> $DIR/modulo_arithmetic_float.rs:7:5
|
LL | 1.6 % -2.1;
| ^^^^^^^^^^
@ -16,7 +16,7 @@ LL | 1.6 % -2.1;
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on constants with different signs: `-1.200 % 3.400`
--> $DIR/modulo_arithmetic_float.rs:15:5
--> $DIR/modulo_arithmetic_float.rs:8:5
|
LL | (1.1 - 2.3) % (1.1 + 2.3);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -24,7 +24,7 @@ LL | (1.1 - 2.3) % (1.1 + 2.3);
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on constants with different signs: `3.400 % -1.200`
--> $DIR/modulo_arithmetic_float.rs:16:5
--> $DIR/modulo_arithmetic_float.rs:9:5
|
LL | (1.1 + 2.3) % (1.1 - 2.3);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@ -32,7 +32,7 @@ LL | (1.1 + 2.3) % (1.1 - 2.3);
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_float.rs:21:5
--> $DIR/modulo_arithmetic_float.rs:14:5
|
LL | a_f32 % b_f32;
| ^^^^^^^^^^^^^
@ -40,7 +40,7 @@ LL | a_f32 % b_f32;
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_float.rs:22:5
--> $DIR/modulo_arithmetic_float.rs:15:5
|
LL | b_f32 % a_f32;
| ^^^^^^^^^^^^^
@ -48,7 +48,7 @@ LL | b_f32 % a_f32;
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_float.rs:23:5
--> $DIR/modulo_arithmetic_float.rs:16:5
|
LL | b_f32 %= a_f32;
| ^^^^^^^^^^^^^^
@ -56,7 +56,7 @@ LL | b_f32 %= a_f32;
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_float.rs:27:5
--> $DIR/modulo_arithmetic_float.rs:20:5
|
LL | a_f64 % b_f64;
| ^^^^^^^^^^^^^
@ -64,7 +64,7 @@ LL | a_f64 % b_f64;
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_float.rs:28:5
--> $DIR/modulo_arithmetic_float.rs:21:5
|
LL | b_f64 % a_f64;
| ^^^^^^^^^^^^^
@ -72,7 +72,7 @@ LL | b_f64 % a_f64;
= note: double check for expected result especially when interoperating with different languages
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_float.rs:29:5
--> $DIR/modulo_arithmetic_float.rs:22:5
|
LL | b_f64 %= a_f64;
| ^^^^^^^^^^^^^^

View file

@ -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 on signed integral numbers

View file

@ -1,5 +1,5 @@
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:15:5
--> $DIR/modulo_arithmetic_integral.rs:8:5
|
LL | a % b;
| ^^^^^
@ -9,7 +9,7 @@ LL | a % b;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:16:5
--> $DIR/modulo_arithmetic_integral.rs:9:5
|
LL | b % a;
| ^^^^^
@ -18,7 +18,7 @@ LL | b % a;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:17:5
--> $DIR/modulo_arithmetic_integral.rs:10:5
|
LL | b %= a;
| ^^^^^^
@ -27,7 +27,7 @@ LL | b %= a;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:21:5
--> $DIR/modulo_arithmetic_integral.rs:14:5
|
LL | a_i8 % b_i8;
| ^^^^^^^^^^^
@ -36,7 +36,7 @@ LL | a_i8 % b_i8;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:22:5
--> $DIR/modulo_arithmetic_integral.rs:15:5
|
LL | b_i8 %= a_i8;
| ^^^^^^^^^^^^
@ -45,7 +45,7 @@ LL | b_i8 %= a_i8;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:26:5
--> $DIR/modulo_arithmetic_integral.rs:19:5
|
LL | a_i16 % b_i16;
| ^^^^^^^^^^^^^
@ -54,7 +54,7 @@ LL | a_i16 % b_i16;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:27:5
--> $DIR/modulo_arithmetic_integral.rs:20:5
|
LL | b_i16 %= a_i16;
| ^^^^^^^^^^^^^^
@ -63,7 +63,7 @@ LL | b_i16 %= a_i16;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:31:5
--> $DIR/modulo_arithmetic_integral.rs:24:5
|
LL | a_i32 % b_i32;
| ^^^^^^^^^^^^^
@ -72,7 +72,7 @@ LL | a_i32 % b_i32;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:32:5
--> $DIR/modulo_arithmetic_integral.rs:25:5
|
LL | b_i32 %= a_i32;
| ^^^^^^^^^^^^^^
@ -81,7 +81,7 @@ LL | b_i32 %= a_i32;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:36:5
--> $DIR/modulo_arithmetic_integral.rs:29:5
|
LL | a_i64 % b_i64;
| ^^^^^^^^^^^^^
@ -90,7 +90,7 @@ LL | a_i64 % b_i64;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:37:5
--> $DIR/modulo_arithmetic_integral.rs:30:5
|
LL | b_i64 %= a_i64;
| ^^^^^^^^^^^^^^
@ -99,7 +99,7 @@ LL | b_i64 %= a_i64;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:41:5
--> $DIR/modulo_arithmetic_integral.rs:34:5
|
LL | a_i128 % b_i128;
| ^^^^^^^^^^^^^^^
@ -108,7 +108,7 @@ LL | a_i128 % b_i128;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:42:5
--> $DIR/modulo_arithmetic_integral.rs:35:5
|
LL | b_i128 %= a_i128;
| ^^^^^^^^^^^^^^^^
@ -117,7 +117,7 @@ LL | b_i128 %= a_i128;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:46:5
--> $DIR/modulo_arithmetic_integral.rs:39:5
|
LL | a_isize % b_isize;
| ^^^^^^^^^^^^^^^^^
@ -126,7 +126,7 @@ LL | a_isize % b_isize;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:47:5
--> $DIR/modulo_arithmetic_integral.rs:40:5
|
LL | b_isize %= a_isize;
| ^^^^^^^^^^^^^^^^^^
@ -135,7 +135,7 @@ LL | b_isize %= a_isize;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:51:5
--> $DIR/modulo_arithmetic_integral.rs:44:5
|
LL | a % b;
| ^^^^^
@ -144,7 +144,7 @@ LL | a % b;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on types that might have different signs
--> $DIR/modulo_arithmetic_integral.rs:52:5
--> $DIR/modulo_arithmetic_integral.rs:45:5
|
LL | b %= a;
| ^^^^^^

View file

@ -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

View file

@ -1,5 +1,5 @@
error: you are using modulo operator on constants with different signs: `-1 % 2`
--> $DIR/modulo_arithmetic_integral_const.rs:13:5
--> $DIR/modulo_arithmetic_integral_const.rs:6:5
|
LL | -1 % 2;
| ^^^^^^
@ -9,7 +9,7 @@ LL | -1 % 2;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `1 % -2`
--> $DIR/modulo_arithmetic_integral_const.rs:14:5
--> $DIR/modulo_arithmetic_integral_const.rs:7:5
|
LL | 1 % -2;
| ^^^^^^
@ -18,7 +18,7 @@ LL | 1 % -2;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `-1 % 3`
--> $DIR/modulo_arithmetic_integral_const.rs:15:5
--> $DIR/modulo_arithmetic_integral_const.rs:8:5
|
LL | (1 - 2) % (1 + 2);
| ^^^^^^^^^^^^^^^^^
@ -27,7 +27,7 @@ LL | (1 - 2) % (1 + 2);
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `3 % -1`
--> $DIR/modulo_arithmetic_integral_const.rs:16:5
--> $DIR/modulo_arithmetic_integral_const.rs:9:5
|
LL | (1 + 2) % (1 - 2);
| ^^^^^^^^^^^^^^^^^
@ -36,7 +36,7 @@ LL | (1 + 2) % (1 - 2);
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `-35 % 300000`
--> $DIR/modulo_arithmetic_integral_const.rs:17:5
--> $DIR/modulo_arithmetic_integral_const.rs:10:5
|
LL | 35 * (7 - 4 * 2) % (-500 * -600);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -45,7 +45,7 @@ LL | 35 * (7 - 4 * 2) % (-500 * -600);
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `-1 % 2`
--> $DIR/modulo_arithmetic_integral_const.rs:19:5
--> $DIR/modulo_arithmetic_integral_const.rs:12:5
|
LL | -1i8 % 2i8;
| ^^^^^^^^^^
@ -54,7 +54,7 @@ LL | -1i8 % 2i8;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `1 % -2`
--> $DIR/modulo_arithmetic_integral_const.rs:20:5
--> $DIR/modulo_arithmetic_integral_const.rs:13:5
|
LL | 1i8 % -2i8;
| ^^^^^^^^^^
@ -63,7 +63,7 @@ LL | 1i8 % -2i8;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `-1 % 2`
--> $DIR/modulo_arithmetic_integral_const.rs:21:5
--> $DIR/modulo_arithmetic_integral_const.rs:14:5
|
LL | -1i16 % 2i16;
| ^^^^^^^^^^^^
@ -72,7 +72,7 @@ LL | -1i16 % 2i16;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `1 % -2`
--> $DIR/modulo_arithmetic_integral_const.rs:22:5
--> $DIR/modulo_arithmetic_integral_const.rs:15:5
|
LL | 1i16 % -2i16;
| ^^^^^^^^^^^^
@ -81,7 +81,7 @@ LL | 1i16 % -2i16;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `-1 % 2`
--> $DIR/modulo_arithmetic_integral_const.rs:23:5
--> $DIR/modulo_arithmetic_integral_const.rs:16:5
|
LL | -1i32 % 2i32;
| ^^^^^^^^^^^^
@ -90,7 +90,7 @@ LL | -1i32 % 2i32;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `1 % -2`
--> $DIR/modulo_arithmetic_integral_const.rs:24:5
--> $DIR/modulo_arithmetic_integral_const.rs:17:5
|
LL | 1i32 % -2i32;
| ^^^^^^^^^^^^
@ -99,7 +99,7 @@ LL | 1i32 % -2i32;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `-1 % 2`
--> $DIR/modulo_arithmetic_integral_const.rs:25:5
--> $DIR/modulo_arithmetic_integral_const.rs:18:5
|
LL | -1i64 % 2i64;
| ^^^^^^^^^^^^
@ -108,7 +108,7 @@ LL | -1i64 % 2i64;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `1 % -2`
--> $DIR/modulo_arithmetic_integral_const.rs:26:5
--> $DIR/modulo_arithmetic_integral_const.rs:19:5
|
LL | 1i64 % -2i64;
| ^^^^^^^^^^^^
@ -117,7 +117,7 @@ LL | 1i64 % -2i64;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `-1 % 2`
--> $DIR/modulo_arithmetic_integral_const.rs:27:5
--> $DIR/modulo_arithmetic_integral_const.rs:20:5
|
LL | -1i128 % 2i128;
| ^^^^^^^^^^^^^^
@ -126,7 +126,7 @@ LL | -1i128 % 2i128;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `1 % -2`
--> $DIR/modulo_arithmetic_integral_const.rs:28:5
--> $DIR/modulo_arithmetic_integral_const.rs:21:5
|
LL | 1i128 % -2i128;
| ^^^^^^^^^^^^^^
@ -135,7 +135,7 @@ LL | 1i128 % -2i128;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `-1 % 2`
--> $DIR/modulo_arithmetic_integral_const.rs:29:5
--> $DIR/modulo_arithmetic_integral_const.rs:22:5
|
LL | -1isize % 2isize;
| ^^^^^^^^^^^^^^^^
@ -144,7 +144,7 @@ LL | -1isize % 2isize;
= note: or consider using `rem_euclid` or similar function
error: you are using modulo operator on constants with different signs: `1 % -2`
--> $DIR/modulo_arithmetic_integral_const.rs:30:5
--> $DIR/modulo_arithmetic_integral_const.rs:23:5
|
LL | 1isize % -2isize;
| ^^^^^^^^^^^^^^^^