mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
clean tests/ui/eq_op.rs
Cleaning the empty lines for clarity.
This commit is contained in:
parent
5013f49195
commit
8fc00c57b6
2 changed files with 44 additions and 52 deletions
|
@ -21,9 +21,6 @@ fn main() {
|
||||||
// unary and binary operators
|
// unary and binary operators
|
||||||
(-(2) < -(2));
|
(-(2) < -(2));
|
||||||
((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
|
((1 + 1) & (1 + 1) == (1 + 1) & (1 + 1));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
|
(1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
|
||||||
|
|
||||||
// various other things
|
// various other things
|
||||||
|
@ -35,7 +32,6 @@ fn main() {
|
||||||
1 + 1 == 2;
|
1 + 1 == 2;
|
||||||
1 - 1 == 0;
|
1 - 1 == 0;
|
||||||
|
|
||||||
|
|
||||||
1 - 1;
|
1 - 1;
|
||||||
1 / 1;
|
1 / 1;
|
||||||
true && true;
|
true && true;
|
||||||
|
@ -47,14 +43,10 @@ fn main() {
|
||||||
let b: u32 = 0;
|
let b: u32 = 0;
|
||||||
|
|
||||||
a == b && b == a;
|
a == b && b == a;
|
||||||
|
|
||||||
a != b && b != a;
|
a != b && b != a;
|
||||||
|
|
||||||
a < b && b > a;
|
a < b && b > a;
|
||||||
|
|
||||||
a <= b && b >= a;
|
a <= b && b >= a;
|
||||||
|
|
||||||
|
|
||||||
let mut a = vec![1];
|
let mut a = vec![1];
|
||||||
a == a;
|
a == a;
|
||||||
2*a.len() == 2*a.len(); // ok, functions
|
2*a.len() == 2*a.len(); // ok, functions
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
error: this boolean expression can be simplified
|
error: this boolean expression can be simplified
|
||||||
--> $DIR/eq_op.rs:41:5
|
--> $DIR/eq_op.rs:37:5
|
||||||
|
|
|
|
||||||
41 | true && true;
|
37 | true && true;
|
||||||
| ^^^^^^^^^^^^ help: try `true`
|
| ^^^^^^^^^^^^ help: try `true`
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
|
@ -11,33 +11,33 @@ note: lint level defined here
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: this boolean expression can be simplified
|
error: this boolean expression can be simplified
|
||||||
--> $DIR/eq_op.rs:43:5
|
--> $DIR/eq_op.rs:39:5
|
||||||
|
|
|
|
||||||
43 | true || true;
|
39 | true || true;
|
||||||
| ^^^^^^^^^^^^ help: try `true`
|
| ^^^^^^^^^^^^ help: try `true`
|
||||||
|
|
||||||
error: this boolean expression can be simplified
|
error: this boolean expression can be simplified
|
||||||
--> $DIR/eq_op.rs:49:5
|
--> $DIR/eq_op.rs:45:5
|
||||||
|
|
|
|
||||||
49 | a == b && b == a;
|
45 | a == b && b == a;
|
||||||
| ^^^^^^^^^^^^^^^^ help: try `a == b`
|
| ^^^^^^^^^^^^^^^^ help: try `a == b`
|
||||||
|
|
||||||
error: this boolean expression can be simplified
|
error: this boolean expression can be simplified
|
||||||
--> $DIR/eq_op.rs:51:5
|
--> $DIR/eq_op.rs:46:5
|
||||||
|
|
|
|
||||||
51 | a != b && b != a;
|
46 | a != b && b != a;
|
||||||
| ^^^^^^^^^^^^^^^^ help: try `a != b`
|
| ^^^^^^^^^^^^^^^^ help: try `a != b`
|
||||||
|
|
||||||
error: this boolean expression can be simplified
|
error: this boolean expression can be simplified
|
||||||
--> $DIR/eq_op.rs:53:5
|
--> $DIR/eq_op.rs:47:5
|
||||||
|
|
|
|
||||||
53 | a < b && b > a;
|
47 | a < b && b > a;
|
||||||
| ^^^^^^^^^^^^^^ help: try `a < b`
|
| ^^^^^^^^^^^^^^ help: try `a < b`
|
||||||
|
|
||||||
error: this boolean expression can be simplified
|
error: this boolean expression can be simplified
|
||||||
--> $DIR/eq_op.rs:55:5
|
--> $DIR/eq_op.rs:48:5
|
||||||
|
|
|
|
||||||
55 | a <= b && b >= a;
|
48 | a <= b && b >= a;
|
||||||
| ^^^^^^^^^^^^^^^^ help: try `a <= b`
|
| ^^^^^^^^^^^^^^^^ help: try `a <= b`
|
||||||
|
|
||||||
error: equal expressions as operands to `==`
|
error: equal expressions as operands to `==`
|
||||||
|
@ -113,99 +113,99 @@ error: equal expressions as operands to `&`
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `==`
|
error: equal expressions as operands to `==`
|
||||||
--> $DIR/eq_op.rs:27:5
|
--> $DIR/eq_op.rs:24:5
|
||||||
|
|
|
|
||||||
27 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
|
24 | (1 * 2) + (3 * 4) == 1 * 2 + 3 * 4;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `!=`
|
error: equal expressions as operands to `!=`
|
||||||
--> $DIR/eq_op.rs:30:5
|
--> $DIR/eq_op.rs:27:5
|
||||||
|
|
|
|
||||||
30 | ([1] != [1]);
|
27 | ([1] != [1]);
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `!=`
|
error: equal expressions as operands to `!=`
|
||||||
--> $DIR/eq_op.rs:31:5
|
--> $DIR/eq_op.rs:28:5
|
||||||
|
|
|
|
||||||
31 | ((1, 2) != (1, 2));
|
28 | ((1, 2) != (1, 2));
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `==`
|
error: equal expressions as operands to `==`
|
||||||
--> $DIR/eq_op.rs:35:5
|
--> $DIR/eq_op.rs:32:5
|
||||||
|
|
|
|
||||||
35 | 1 + 1 == 2;
|
32 | 1 + 1 == 2;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `==`
|
error: equal expressions as operands to `==`
|
||||||
--> $DIR/eq_op.rs:36:5
|
--> $DIR/eq_op.rs:33:5
|
||||||
|
|
|
|
||||||
36 | 1 - 1 == 0;
|
33 | 1 - 1 == 0;
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `-`
|
error: equal expressions as operands to `-`
|
||||||
--> $DIR/eq_op.rs:36:5
|
--> $DIR/eq_op.rs:33:5
|
||||||
|
|
|
|
||||||
36 | 1 - 1 == 0;
|
33 | 1 - 1 == 0;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `-`
|
error: equal expressions as operands to `-`
|
||||||
--> $DIR/eq_op.rs:39:5
|
--> $DIR/eq_op.rs:35:5
|
||||||
|
|
|
|
||||||
39 | 1 - 1;
|
35 | 1 - 1;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `/`
|
error: equal expressions as operands to `/`
|
||||||
--> $DIR/eq_op.rs:40:5
|
--> $DIR/eq_op.rs:36:5
|
||||||
|
|
|
|
||||||
40 | 1 / 1;
|
36 | 1 / 1;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `&&`
|
error: equal expressions as operands to `&&`
|
||||||
--> $DIR/eq_op.rs:41:5
|
--> $DIR/eq_op.rs:37:5
|
||||||
|
|
|
|
||||||
41 | true && true;
|
37 | true && true;
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `||`
|
error: equal expressions as operands to `||`
|
||||||
--> $DIR/eq_op.rs:43:5
|
--> $DIR/eq_op.rs:39:5
|
||||||
|
|
|
|
||||||
43 | true || true;
|
39 | true || true;
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `&&`
|
error: equal expressions as operands to `&&`
|
||||||
--> $DIR/eq_op.rs:49:5
|
--> $DIR/eq_op.rs:45:5
|
||||||
|
|
|
|
||||||
49 | a == b && b == a;
|
45 | a == b && b == a;
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `&&`
|
error: equal expressions as operands to `&&`
|
||||||
--> $DIR/eq_op.rs:51:5
|
--> $DIR/eq_op.rs:46:5
|
||||||
|
|
|
|
||||||
51 | a != b && b != a;
|
46 | a != b && b != a;
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `&&`
|
error: equal expressions as operands to `&&`
|
||||||
--> $DIR/eq_op.rs:53:5
|
--> $DIR/eq_op.rs:47:5
|
||||||
|
|
|
|
||||||
53 | a < b && b > a;
|
47 | a < b && b > a;
|
||||||
| ^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `&&`
|
error: equal expressions as operands to `&&`
|
||||||
--> $DIR/eq_op.rs:55:5
|
--> $DIR/eq_op.rs:48:5
|
||||||
|
|
|
|
||||||
55 | a <= b && b >= a;
|
48 | a <= b && b >= a;
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: equal expressions as operands to `==`
|
error: equal expressions as operands to `==`
|
||||||
--> $DIR/eq_op.rs:59:5
|
--> $DIR/eq_op.rs:51:5
|
||||||
|
|
|
|
||||||
59 | a == a;
|
51 | a == a;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
warning: taken reference of right operand
|
warning: taken reference of right operand
|
||||||
--> $DIR/eq_op.rs:97:13
|
--> $DIR/eq_op.rs:89:13
|
||||||
|
|
|
|
||||||
97 | let z = x & &y;
|
89 | let z = x & &y;
|
||||||
| ^^^^--
|
| ^^^^--
|
||||||
| |
|
| |
|
||||||
| help: use the right value directly `y`
|
| help: use the right value directly `y`
|
||||||
|
|
Loading…
Reference in a new issue