Skip to content

Commit

Permalink
type_alias_enum_variants: cleanup redundant 'allow(unused)'.
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Jun 16, 2019
1 parent 46f405e commit 57e6869
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#![allow(irrefutable_let_patterns)]

#[allow(dead_code)]
enum Enum<T> { TSVariant(T), SVariant { v: T }, UVariant }
type Alias<T> = Enum<T>;
type AliasFixed = Enum<()>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// Check that creating/matching on an enum variant through an alias with
// the wrong braced/unit form is caught as an error.

#![allow(unreachable_code)]

enum Enum { Braced {}, Unit, Tuple() }
type Alias = Enum;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error[E0533]: expected unit struct/variant or constant, found struct variant `<Alias>::Braced`
--> $DIR/incorrect-variant-form-through-alias-caught.rs:12:5
--> $DIR/incorrect-variant-form-through-alias-caught.rs:10:5
|
LL | Alias::Braced;
| ^^^^^^^^^^^^^

error[E0533]: expected unit struct/variant or constant, found struct variant `<Alias>::Braced`
--> $DIR/incorrect-variant-form-through-alias-caught.rs:14:9
--> $DIR/incorrect-variant-form-through-alias-caught.rs:12:9
|
LL | let Alias::Braced = panic!();
| ^^^^^^^^^^^^^

error[E0164]: expected tuple struct/variant, found struct variant `<Alias>::Braced`
--> $DIR/incorrect-variant-form-through-alias-caught.rs:16:9
--> $DIR/incorrect-variant-form-through-alias-caught.rs:14:9
|
LL | let Alias::Braced(..) = panic!();
| ^^^^^^^^^^^^^^^^^ not a tuple variant or struct

error[E0618]: expected function, found enum variant `<Alias>::Unit`
--> $DIR/incorrect-variant-form-through-alias-caught.rs:19:5
--> $DIR/incorrect-variant-form-through-alias-caught.rs:17:5
|
LL | enum Enum { Braced {}, Unit, Tuple() }
| ---- `<Alias>::Unit` defined here
Expand All @@ -32,7 +32,7 @@ LL | <Alias>::Unit;
| ^^^^^^^^^^^^^

error[E0164]: expected tuple struct/variant, found unit variant `<Alias>::Unit`
--> $DIR/incorrect-variant-form-through-alias-caught.rs:21:9
--> $DIR/incorrect-variant-form-through-alias-caught.rs:19:9
|
LL | let Alias::Unit() = panic!();
| ^^^^^^^^^^^^^ not a tuple variant or struct
Expand Down

0 comments on commit 57e6869

Please # to comment.