Skip to content

Commit c1974c4

Browse files
Fix tests
1 parent ca67164 commit c1974c4

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed
+10-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
#![deny(dead_code)]
22

33
#[derive(Clone)]
4-
enum Enum {
4+
enum Enum1 {
55
Variant1, //~ ERROR: variant `Variant1` is never constructed
66
Variant2,
77
}
88

9+
#[derive(Debug)]
10+
enum Enum2 {
11+
Variant1(i32), //~ ERROR: variant `Variant1` is never constructed
12+
Variant2,
13+
}
14+
915
fn main() {
10-
let e = Enum::Variant2;
16+
let e = Enum1::Variant2;
1117
e.clone();
18+
19+
let _ = Enum2::Variant2;
1220
}
+14-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
error: variant `Variant1` is never constructed
22
--> $DIR/unused-variant.rs:5:5
33
|
4-
LL | enum Enum {
5-
| ---- variant in this enum
4+
LL | enum Enum1 {
5+
| ----- variant in this enum
66
LL | Variant1,
77
| ^^^^^^^^
88
|
9-
= note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
9+
= note: `Enum1` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis
1010
note: the lint level is defined here
1111
--> $DIR/unused-variant.rs:1:9
1212
|
1313
LL | #![deny(dead_code)]
1414
| ^^^^^^^^^
1515

16-
error: aborting due to 1 previous error
16+
error: variant `Variant1` is never constructed
17+
--> $DIR/unused-variant.rs:11:5
18+
|
19+
LL | enum Enum2 {
20+
| ----- variant in this enum
21+
LL | Variant1(i32),
22+
| ^^^^^^^^
23+
|
24+
= note: `Enum2` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
25+
26+
error: aborting due to 2 previous errors
1727

0 commit comments

Comments
 (0)