Skip to content

Commit 28555d1

Browse files
committed
Split must_use_unit test into an unfixable part
With the attribute refactor in rustc, making this case machine applicable is not easily possible anymore. This splits up the tests properly.
1 parent 53a1ff7 commit 28555d1

5 files changed

+11
-43
lines changed

tests/ui/must_use_unit.fixed

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,3 @@ fn main() {
2626
fn foo() {}
2727
);
2828
}
29-
30-
#[cfg_attr(all(), deprecated)]
31-
fn issue_12320() {}
32-
//~^ must_use_unit
33-
34-
#[cfg_attr(all(), deprecated, doc = "foo")]
35-
fn issue_12320_2() {}
36-
//~^ must_use_unit

tests/ui/must_use_unit.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,3 @@ fn main() {
2929
fn foo() {}
3030
);
3131
}
32-
33-
#[cfg_attr(all(), must_use, deprecated)]
34-
fn issue_12320() {}
35-
//~^ must_use_unit
36-
37-
#[cfg_attr(all(), deprecated, doc = "foo", must_use)]
38-
fn issue_12320_2() {}
39-
//~^ must_use_unit

tests/ui/must_use_unit.stderr

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,5 @@ LL | #[must_use = "With note"]
2525
LL | pub fn must_use_with_note() {}
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2727

28-
error: this unit-returning function has a `#[must_use]` attribute
29-
--> tests/ui/must_use_unit.rs:34:1
30-
|
31-
LL | #[cfg_attr(all(), must_use, deprecated)]
32-
| -------------------- help: change these attributes to: `deprecated`
33-
LL | fn issue_12320() {}
34-
| ^^^^^^^^^^^^^^^^
35-
36-
error: this unit-returning function has a `#[must_use]` attribute
37-
--> tests/ui/must_use_unit.rs:38:1
38-
|
39-
LL | #[cfg_attr(all(), deprecated, doc = "foo", must_use)]
40-
| --------------------------------- help: change these attributes to: `deprecated, doc = "foo"`
41-
LL | fn issue_12320_2() {}
42-
| ^^^^^^^^^^^^^^^^^^
43-
44-
error: aborting due to 5 previous errors
28+
error: aborting due to 3 previous errors
4529

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
//@aux-build:proc_macros.rs
21
//@no-rustfix
32

4-
#![warn(clippy::must_use_unit)]
5-
#![allow(clippy::unused_unit)]
6-
73
#[cfg_attr(all(), must_use, deprecated)]
84
fn issue_12320() {}
5+
//~^ must_use_unit
96

107
#[cfg_attr(all(), deprecated, doc = "foo", must_use)]
118
fn issue_12320_2() {}
9+
//~^ must_use_unit
10+
11+
fn main() {}

tests/ui/must_use_unit_12320.stderr renamed to tests/ui/must_use_unit_unfixable.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error: this unit-returning function has a `#[must_use]` attribute
2-
--> tests/ui/must_use_unit_12320.rs:8:1
2+
--> tests/ui/must_use_unit_unfixable.rs:4:1
33
|
44
LL | fn issue_12320() {}
55
| ^^^^^^^^^^^^^^^^
66
|
77
help: remove `must_use`
8-
--> tests/ui/must_use_unit_12320.rs:7:19
8+
--> tests/ui/must_use_unit_unfixable.rs:3:19
99
|
1010
LL | #[cfg_attr(all(), must_use, deprecated)]
1111
| ^^^^^^^^
12-
= note: `-D clippy::double-must-use` implied by `-D warnings`
13-
= help: to override `-D warnings` add `#[allow(clippy::double_must_use)]`
12+
= note: `-D clippy::must-use-unit` implied by `-D warnings`
13+
= help: to override `-D warnings` add `#[allow(clippy::must_use_unit)]`
1414

1515
error: this unit-returning function has a `#[must_use]` attribute
16-
--> tests/ui/must_use_unit_12320.rs:11:1
16+
--> tests/ui/must_use_unit_unfixable.rs:8:1
1717
|
1818
LL | fn issue_12320_2() {}
1919
| ^^^^^^^^^^^^^^^^^^
2020
|
2121
help: remove `must_use`
22-
--> tests/ui/must_use_unit_12320.rs:10:44
22+
--> tests/ui/must_use_unit_unfixable.rs:7:44
2323
|
2424
LL | #[cfg_attr(all(), deprecated, doc = "foo", must_use)]
2525
| ^^^^^^^^

0 commit comments

Comments
 (0)