Skip to content

Commit 5eba680

Browse files
committed
Update test files
1 parent fad122e commit 5eba680

File tree

3 files changed

+113
-109
lines changed

3 files changed

+113
-109
lines changed

tests/ui/unit_arg.fixed

Lines changed: 0 additions & 79 deletions
This file was deleted.

tests/ui/unit_arg.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// run-rustfix
21
#![warn(clippy::unit_arg)]
32
#![allow(clippy::no_effect, unused_must_use, unused_variables)]
43

@@ -36,6 +35,20 @@ fn bad() {
3635
1;
3736
});
3837
taking_multiple_units(foo(0), foo(1));
38+
taking_multiple_units(foo(0), {
39+
foo(1);
40+
foo(2);
41+
});
42+
taking_multiple_units(
43+
{
44+
foo(0);
45+
foo(1);
46+
},
47+
{
48+
foo(2);
49+
foo(3);
50+
},
51+
);
3952
}
4053

4154
fn ok() {

tests/ui/unit_arg.stderr

Lines changed: 99 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,141 +1,211 @@
11
error: passing a unit value to a function
2-
--> $DIR/unit_arg.rs:24:5
2+
--> $DIR/unit_arg.rs:23:5
33
|
44
LL | foo({});
55
| ^^^^^^^
66
|
77
= note: `-D clippy::unit-arg` implied by `-D warnings`
88
help: move the expressions in front of the call...
99
|
10-
LL | {}; foo({});
11-
| ^^^
10+
LL | {};
11+
|
1212
help: ...and use unit literals instead
1313
|
1414
LL | foo(());
1515
| ^^
1616

1717
error: passing a unit value to a function
18-
--> $DIR/unit_arg.rs:25:5
18+
--> $DIR/unit_arg.rs:24:5
1919
|
2020
LL | / foo({
2121
LL | | 1;
2222
LL | | });
2323
| |______^
2424
|
25-
help: move the expressions in front of the call...
25+
help: remove the semicolon from the last statement in the block
26+
|
27+
LL | 1
28+
|
29+
help: or move the expressions in front of the call...
2630
|
2731
LL | {
2832
LL | 1;
29-
LL | }; foo({
33+
LL | };
3034
|
3135
help: ...and use unit literals instead
3236
|
3337
LL | foo(());
3438
| ^^
3539

3640
error: passing a unit value to a function
37-
--> $DIR/unit_arg.rs:28:5
41+
--> $DIR/unit_arg.rs:27:5
3842
|
3943
LL | foo(foo(1));
4044
| ^^^^^^^^^^^
4145
|
4246
help: move the expressions in front of the call...
4347
|
44-
LL | foo(1); foo(foo(1));
45-
| ^^^^^^^
48+
LL | foo(1);
49+
|
4650
help: ...and use unit literals instead
4751
|
4852
LL | foo(());
4953
| ^^
5054

5155
error: passing a unit value to a function
52-
--> $DIR/unit_arg.rs:29:5
56+
--> $DIR/unit_arg.rs:28:5
5357
|
5458
LL | / foo({
5559
LL | | foo(1);
5660
LL | | foo(2);
5761
LL | | });
5862
| |______^
5963
|
60-
help: move the expressions in front of the call...
64+
help: remove the semicolon from the last statement in the block
65+
|
66+
LL | foo(2)
67+
|
68+
help: or move the expressions in front of the call...
6169
|
6270
LL | {
6371
LL | foo(1);
6472
LL | foo(2);
65-
LL | }; foo({
73+
LL | };
6674
|
6775
help: ...and use unit literals instead
6876
|
6977
LL | foo(());
7078
| ^^
7179

7280
error: passing a unit value to a function
73-
--> $DIR/unit_arg.rs:33:5
81+
--> $DIR/unit_arg.rs:32:5
7482
|
7583
LL | foo3({}, 2, 2);
7684
| ^^^^^^^^^^^^^^
7785
|
7886
help: move the expressions in front of the call...
7987
|
80-
LL | {}; foo3({}, 2, 2);
81-
| ^^^
88+
LL | {};
89+
|
8290
help: ...and use unit literals instead
8391
|
8492
LL | foo3((), 2, 2);
8593
| ^^
8694

8795
error: passing a unit value to a function
88-
--> $DIR/unit_arg.rs:35:5
96+
--> $DIR/unit_arg.rs:34:5
8997
|
9098
LL | / b.bar({
9199
LL | | 1;
92100
LL | | });
93101
| |______^
94102
|
95-
help: move the expressions in front of the call...
103+
help: remove the semicolon from the last statement in the block
104+
|
105+
LL | 1
106+
|
107+
help: or move the expressions in front of the call...
96108
|
97109
LL | {
98110
LL | 1;
99-
LL | }; b.bar({
111+
LL | };
100112
|
101113
help: ...and use unit literals instead
102114
|
103115
LL | b.bar(());
104116
| ^^
105117

106118
error: passing a unit value to a function
107-
--> $DIR/unit_arg.rs:38:5
119+
--> $DIR/unit_arg.rs:37:5
108120
|
109121
LL | taking_multiple_units(foo(0), foo(1));
110122
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
111123
|
112124
help: move the expressions in front of the call...
113125
|
114-
LL | foo(0); foo(1); taking_multiple_units(foo(0), foo(1));
115-
| ^^^^^^^^^^^^^^^
126+
LL | foo(0);
127+
LL | foo(1);
128+
|
116129
help: ...and use unit literals instead
117130
|
118-
LL | taking_multiple_units((), foo(1));
119-
| ^^
131+
LL | taking_multiple_units((), ());
132+
| ^^ ^^
133+
134+
error: passing a unit value to a function
135+
--> $DIR/unit_arg.rs:38:5
136+
|
137+
LL | / taking_multiple_units(foo(0), {
138+
LL | | foo(1);
139+
LL | | foo(2);
140+
LL | | });
141+
| |______^
142+
|
143+
help: remove the semicolon from the last statement in the block
144+
|
145+
LL | foo(2)
146+
|
147+
help: or move the expressions in front of the call...
148+
|
149+
LL | foo(0);
150+
LL | {
151+
LL | foo(1);
152+
LL | foo(2);
153+
LL | };
154+
|
155+
help: ...and use unit literals instead
156+
|
157+
LL | taking_multiple_units((), ());
158+
| ^^ ^^
159+
160+
error: passing a unit value to a function
161+
--> $DIR/unit_arg.rs:42:5
162+
|
163+
LL | / taking_multiple_units(
164+
LL | | {
165+
LL | | foo(0);
166+
LL | | foo(1);
167+
... |
168+
LL | | },
169+
LL | | );
170+
| |_____^
171+
|
172+
help: remove the semicolon from the last statement in the block
173+
|
174+
LL | foo(1)
175+
|
176+
help: remove the semicolon from the last statement in the block
177+
|
178+
LL | foo(3)
179+
|
180+
help: or move the expressions in front of the call...
181+
|
182+
LL | {
183+
LL | foo(0);
184+
LL | foo(1);
185+
LL | };
186+
LL | {
187+
LL | foo(2);
188+
...
120189
help: ...and use unit literals instead
121190
|
122-
LL | taking_multiple_units(foo(0), ());
123-
| ^^
191+
LL | (),
192+
LL | (),
193+
|
124194

125195
error: passing a unit value to a function
126-
--> $DIR/unit_arg.rs:71:5
196+
--> $DIR/unit_arg.rs:84:5
127197
|
128198
LL | Some(foo(1))
129199
| ^^^^^^^^^^^^
130200
|
131201
help: move the expressions in front of the call...
132202
|
133-
LL | foo(1); Some(foo(1))
134-
| ^^^^^^^
203+
LL | foo(1);
204+
|
135205
help: ...and use unit literals instead
136206
|
137207
LL | Some(())
138208
| ^^
139209

140-
error: aborting due to 8 previous errors
210+
error: aborting due to 10 previous errors
141211

0 commit comments

Comments
 (0)