mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
clean tests/ui/absurd-extreme-comparisons.rs
Cleaning the empty lines for clarity.
This commit is contained in:
parent
5f94763c69
commit
e18a250139
2 changed files with 36 additions and 77 deletions
|
@ -6,68 +6,27 @@
|
|||
|
||||
fn main() {
|
||||
const Z: u32 = 0;
|
||||
|
||||
let u: u32 = 42;
|
||||
|
||||
u <= 0;
|
||||
|
||||
|
||||
u <= Z;
|
||||
|
||||
|
||||
u < Z;
|
||||
|
||||
|
||||
Z >= u;
|
||||
|
||||
|
||||
Z > u;
|
||||
|
||||
|
||||
u > std::u32::MAX;
|
||||
|
||||
|
||||
u >= std::u32::MAX;
|
||||
|
||||
|
||||
std::u32::MAX < u;
|
||||
|
||||
|
||||
std::u32::MAX <= u;
|
||||
|
||||
|
||||
|
||||
1-1 > u;
|
||||
|
||||
|
||||
u >= !0;
|
||||
|
||||
|
||||
u <= 12 - 2*6;
|
||||
|
||||
|
||||
|
||||
let i: i8 = 0;
|
||||
i < -127 - 1;
|
||||
|
||||
|
||||
std::i8::MAX >= i;
|
||||
|
||||
|
||||
3-7 < std::i32::MIN;
|
||||
|
||||
|
||||
|
||||
let b = false;
|
||||
b >= true;
|
||||
|
||||
|
||||
false > b;
|
||||
|
||||
|
||||
|
||||
u > 0; // ok
|
||||
|
||||
// this is handled by unit_cmp
|
||||
() < {};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:12:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:10:5
|
||||
|
|
||||
12 | u <= 0;
|
||||
10 | u <= 0;
|
||||
| ^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
|
@ -12,137 +12,137 @@ note: lint level defined here
|
|||
= help: because 0 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 0 instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:15:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:11:5
|
||||
|
|
||||
15 | u <= Z;
|
||||
11 | u <= Z;
|
||||
| ^^^^^^
|
||||
|
|
||||
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == Z instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:18:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:12:5
|
||||
|
|
||||
18 | u < Z;
|
||||
12 | u < Z;
|
||||
| ^^^^^
|
||||
|
|
||||
= help: because Z is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:21:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:13:5
|
||||
|
|
||||
21 | Z >= u;
|
||||
13 | Z >= u;
|
||||
| ^^^^^^
|
||||
|
|
||||
= help: because Z is the minimum value for this type, the case where the two sides are not equal never occurs, consider using Z == u instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:24:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:14:5
|
||||
|
|
||||
24 | Z > u;
|
||||
14 | Z > u;
|
||||
| ^^^^^
|
||||
|
|
||||
= help: because Z is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:27:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:15:5
|
||||
|
|
||||
27 | u > std::u32::MAX;
|
||||
15 | u > std::u32::MAX;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:30:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:16:5
|
||||
|
|
||||
30 | u >= std::u32::MAX;
|
||||
16 | u >= std::u32::MAX;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == std::u32::MAX instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:33:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:17:5
|
||||
|
|
||||
33 | std::u32::MAX < u;
|
||||
17 | std::u32::MAX < u;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: because std::u32::MAX is the maximum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:36:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:18:5
|
||||
|
|
||||
36 | std::u32::MAX <= u;
|
||||
18 | std::u32::MAX <= u;
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: because std::u32::MAX is the maximum value for this type, the case where the two sides are not equal never occurs, consider using std::u32::MAX == u instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:40:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:19:5
|
||||
|
|
||||
40 | 1-1 > u;
|
||||
19 | 1-1 > u;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: because 1-1 is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:43:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:20:5
|
||||
|
|
||||
43 | u >= !0;
|
||||
20 | u >= !0;
|
||||
| ^^^^^^^
|
||||
|
|
||||
= help: because !0 is the maximum value for this type, the case where the two sides are not equal never occurs, consider using u == !0 instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:46:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:21:5
|
||||
|
|
||||
46 | u <= 12 - 2*6;
|
||||
21 | u <= 12 - 2*6;
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= help: because 12 - 2*6 is the minimum value for this type, the case where the two sides are not equal never occurs, consider using u == 12 - 2*6 instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:51:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:23:5
|
||||
|
|
||||
51 | i < -127 - 1;
|
||||
23 | i < -127 - 1;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= help: because -127 - 1 is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:54:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:24:5
|
||||
|
|
||||
54 | std::i8::MAX >= i;
|
||||
24 | std::i8::MAX >= i;
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: because std::i8::MAX is the maximum value for this type, this comparison is always true
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:57:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:25:5
|
||||
|
|
||||
57 | 3-7 < std::i32::MIN;
|
||||
25 | 3-7 < std::i32::MIN;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: because std::i32::MIN is the minimum value for this type, this comparison is always false
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:62:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:27:5
|
||||
|
|
||||
62 | b >= true;
|
||||
27 | b >= true;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: because true is the maximum value for this type, the case where the two sides are not equal never occurs, consider using b == true instead
|
||||
|
||||
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:65:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:28:5
|
||||
|
|
||||
65 | false > b;
|
||||
28 | false > b;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: because false is the minimum value for this type, this comparison is always false
|
||||
|
||||
warning: <-comparison of unit values detected. This will always be false
|
||||
--> $DIR/absurd-extreme-comparisons.rs:72:5
|
||||
--> $DIR/absurd-extreme-comparisons.rs:31:5
|
||||
|
|
||||
72 | () < {};
|
||||
31 | () < {};
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: #[warn(unit_cmp)] on by default
|
||||
|
|
Loading…
Reference in a new issue