File tree Expand file tree Collapse file tree 3 files changed +45
-26
lines changed
Expand file tree Collapse file tree 3 files changed +45
-26
lines changed Original file line number Diff line number Diff line change 1+ // run-rustfix
2+
3+ #[allow(clippy::no_effect, clippy::unnecessary_operation)]
4+ #[warn(clippy::int_plus_one)]
5+ fn main() {
6+ let x = 1i32;
7+ let y = 0i32;
8+
9+ let _ = x > y;
10+ let _ = y < x;
11+
12+ let _ = x > y;
13+ let _ = y < x;
14+
15+ let _ = x > y; // should be ok
16+ let _ = y < x; // should be ok
17+ }
Original file line number Diff line number Diff line change 1+ // run-rustfix
2+
13#[ allow( clippy:: no_effect, clippy:: unnecessary_operation) ]
24#[ warn( clippy:: int_plus_one) ]
35fn main ( ) {
46 let x = 1i32 ;
57 let y = 0i32 ;
68
7- x >= y + 1 ;
8- y + 1 <= x;
9+ let _ = x >= y + 1 ;
10+ let _ = y + 1 <= x;
911
10- x - 1 >= y;
11- y <= x - 1 ;
12+ let _ = x - 1 >= y;
13+ let _ = y <= x - 1 ;
1214
13- x > y; // should be ok
14- y < x; // should be ok
15+ let _ = x > y; // should be ok
16+ let _ = y < x; // should be ok
1517}
Original file line number Diff line number Diff line change 11error: Unnecessary `>= y + 1` or `x - 1 >=`
2- --> $DIR/int_plus_one.rs:7:5
2+ --> $DIR/int_plus_one.rs:9:13
33 |
4- LL | x >= y + 1;
5- | ^^^^^^^^^^
4+ LL | let _ = x >= y + 1;
5+ | ^^^^^^^^^^
66 |
77 = note: `-D clippy::int-plus-one` implied by `-D warnings`
88help: change `>= y + 1` to `> y` as shown
99 |
10- LL | x > y;
11- | ^^^^^
10+ LL | let _ = x > y;
11+ | ^^^^^
1212
1313error: Unnecessary `>= y + 1` or `x - 1 >=`
14- --> $DIR/int_plus_one.rs:8:5
14+ --> $DIR/int_plus_one.rs:10:13
1515 |
16- LL | y + 1 <= x;
17- | ^^^^^^^^^^
16+ LL | let _ = y + 1 <= x;
17+ | ^^^^^^^^^^
1818help: change `>= y + 1` to `> y` as shown
1919 |
20- LL | y < x;
21- | ^^^^^
20+ LL | let _ = y < x;
21+ | ^^^^^
2222
2323error: Unnecessary `>= y + 1` or `x - 1 >=`
24- --> $DIR/int_plus_one.rs:10:5
24+ --> $DIR/int_plus_one.rs:12:13
2525 |
26- LL | x - 1 >= y;
27- | ^^^^^^^^^^
26+ LL | let _ = x - 1 >= y;
27+ | ^^^^^^^^^^
2828help: change `>= y + 1` to `> y` as shown
2929 |
30- LL | x > y;
31- | ^^^^^
30+ LL | let _ = x > y;
31+ | ^^^^^
3232
3333error: Unnecessary `>= y + 1` or `x - 1 >=`
34- --> $DIR/int_plus_one.rs:11:5
34+ --> $DIR/int_plus_one.rs:13:13
3535 |
36- LL | y <= x - 1;
37- | ^^^^^^^^^^
36+ LL | let _ = y <= x - 1;
37+ | ^^^^^^^^^^
3838help: change `>= y + 1` to `> y` as shown
3939 |
40- LL | y < x;
41- | ^^^^^
40+ LL | let _ = y < x;
41+ | ^^^^^
4242
4343error: aborting due to 4 previous errors
4444
You can’t perform that action at this time.
0 commit comments