File tree 2 files changed +24
-6
lines changed
2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 1
1
#![ deny( dead_code) ]
2
2
3
3
#[ derive( Clone ) ]
4
- enum Enum {
4
+ enum Enum1 {
5
5
Variant1 , //~ ERROR: variant `Variant1` is never constructed
6
6
Variant2 ,
7
7
}
8
8
9
+ #[ derive( Debug ) ]
10
+ enum Enum2 {
11
+ Variant1 ( i32 ) , //~ ERROR: variant `Variant1` is never constructed
12
+ Variant2 ,
13
+ }
14
+
9
15
fn main ( ) {
10
- let e = Enum :: Variant2 ;
16
+ let e = Enum1 :: Variant2 ;
11
17
e. clone ( ) ;
18
+
19
+ let _ = Enum2 :: Variant2 ;
12
20
}
Original file line number Diff line number Diff line change 1
1
error: variant `Variant1` is never constructed
2
2
--> $DIR/unused-variant.rs:5:5
3
3
|
4
- LL | enum Enum {
5
- | ---- variant in this enum
4
+ LL | enum Enum1 {
5
+ | ----- variant in this enum
6
6
LL | Variant1,
7
7
| ^^^^^^^^
8
8
|
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
10
10
note: the lint level is defined here
11
11
--> $DIR/unused-variant.rs:1:9
12
12
|
13
13
LL | #![deny(dead_code)]
14
14
| ^^^^^^^^^
15
15
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
17
27
You can’t perform that action at this time.
0 commit comments