Skip to content

Commit cb341c8

Browse files
committed
Add run-rustfix for assign_ops test
1 parent 949b347 commit cb341c8

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

tests/ui/assign_ops.fixed

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// run-rustfix
2+
3+
#[allow(dead_code, unused_assignments)]
4+
#[warn(clippy::assign_op_pattern)]
5+
fn main() {
6+
let mut a = 5;
7+
a += 1;
8+
a += 1;
9+
a -= 1;
10+
a *= 99;
11+
a *= 42;
12+
a /= 2;
13+
a %= 5;
14+
a &= 1;
15+
a = 1 - a;
16+
a = 5 / a;
17+
a = 42 % a;
18+
a = 6 << a;
19+
let mut s = String::new();
20+
s += "bla";
21+
}

tests/ui/assign_ops.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// run-rustfix
2+
13
#[allow(dead_code, unused_assignments)]
24
#[warn(clippy::assign_op_pattern)]
35
fn main() {

tests/ui/assign_ops.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
error: manual implementation of an assign operation
2-
--> $DIR/assign_ops.rs:5:5
2+
--> $DIR/assign_ops.rs:7:5
33
|
44
LL | a = a + 1;
55
| ^^^^^^^^^ help: replace it with: `a += 1`
66
|
77
= note: `-D clippy::assign-op-pattern` implied by `-D warnings`
88

99
error: manual implementation of an assign operation
10-
--> $DIR/assign_ops.rs:6:5
10+
--> $DIR/assign_ops.rs:8:5
1111
|
1212
LL | a = 1 + a;
1313
| ^^^^^^^^^ help: replace it with: `a += 1`
1414

1515
error: manual implementation of an assign operation
16-
--> $DIR/assign_ops.rs:7:5
16+
--> $DIR/assign_ops.rs:9:5
1717
|
1818
LL | a = a - 1;
1919
| ^^^^^^^^^ help: replace it with: `a -= 1`
2020

2121
error: manual implementation of an assign operation
22-
--> $DIR/assign_ops.rs:8:5
22+
--> $DIR/assign_ops.rs:10:5
2323
|
2424
LL | a = a * 99;
2525
| ^^^^^^^^^^ help: replace it with: `a *= 99`
2626

2727
error: manual implementation of an assign operation
28-
--> $DIR/assign_ops.rs:9:5
28+
--> $DIR/assign_ops.rs:11:5
2929
|
3030
LL | a = 42 * a;
3131
| ^^^^^^^^^^ help: replace it with: `a *= 42`
3232

3333
error: manual implementation of an assign operation
34-
--> $DIR/assign_ops.rs:10:5
34+
--> $DIR/assign_ops.rs:12:5
3535
|
3636
LL | a = a / 2;
3737
| ^^^^^^^^^ help: replace it with: `a /= 2`
3838

3939
error: manual implementation of an assign operation
40-
--> $DIR/assign_ops.rs:11:5
40+
--> $DIR/assign_ops.rs:13:5
4141
|
4242
LL | a = a % 5;
4343
| ^^^^^^^^^ help: replace it with: `a %= 5`
4444

4545
error: manual implementation of an assign operation
46-
--> $DIR/assign_ops.rs:12:5
46+
--> $DIR/assign_ops.rs:14:5
4747
|
4848
LL | a = a & 1;
4949
| ^^^^^^^^^ help: replace it with: `a &= 1`
5050

5151
error: manual implementation of an assign operation
52-
--> $DIR/assign_ops.rs:18:5
52+
--> $DIR/assign_ops.rs:20:5
5353
|
5454
LL | s = s + "bla";
5555
| ^^^^^^^^^^^^^ help: replace it with: `s += "bla"`

0 commit comments

Comments
 (0)