diff options
author | Aleksey Kladov <[email protected]> | 2019-09-12 22:31:04 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-12 22:31:04 +0100 |
commit | bcf30d389c3744ab517372431eb7e1e1dfcc50df (patch) | |
tree | 8b34525b463ba62d9b1acc90a790a438ba8f9ee0 /crates/ra_hir/src/ty | |
parent | 45117c63884366ee82102a782a62a09fefff746b (diff) |
generalize impl_froms to nested enums
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/lower.rs | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs index 587dc12ee..105c893f0 100644 --- a/crates/ra_hir/src/ty/lower.rs +++ b/crates/ra_hir/src/ty/lower.rs | |||
@@ -611,25 +611,15 @@ pub enum TypableDef { | |||
611 | Static(Static), | 611 | Static(Static), |
612 | BuiltinType(BuiltinType), | 612 | BuiltinType(BuiltinType), |
613 | } | 613 | } |
614 | impl_froms!(TypableDef: Function, AdtDef, EnumVariant, TypeAlias, Const, Static, BuiltinType); | 614 | impl_froms!( |
615 | 615 | TypableDef: Function, | |
616 | impl From<Struct> for TypableDef { | 616 | AdtDef(Struct, Enum, Union), |
617 | fn from(it: Struct) -> TypableDef { | 617 | EnumVariant, |
618 | TypableDef::AdtDef(AdtDef::Struct(it)) | 618 | TypeAlias, |
619 | } | 619 | Const, |
620 | } | 620 | Static, |
621 | 621 | BuiltinType | |
622 | impl From<Enum> for TypableDef { | 622 | ); |
623 | fn from(it: Enum) -> TypableDef { | ||
624 | TypableDef::AdtDef(AdtDef::Enum(it)) | ||
625 | } | ||
626 | } | ||
627 | |||
628 | impl From<Union> for TypableDef { | ||
629 | fn from(it: Union) -> TypableDef { | ||
630 | TypableDef::AdtDef(AdtDef::Union(it)) | ||
631 | } | ||
632 | } | ||
633 | 623 | ||
634 | impl From<ModuleDef> for Option<TypableDef> { | 624 | impl From<ModuleDef> for Option<TypableDef> { |
635 | fn from(def: ModuleDef) -> Option<TypableDef> { | 625 | fn from(def: ModuleDef) -> Option<TypableDef> { |