aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-09-12 22:31:04 +0100
committerAleksey Kladov <[email protected]>2019-09-12 22:31:04 +0100
commitbcf30d389c3744ab517372431eb7e1e1dfcc50df (patch)
tree8b34525b463ba62d9b1acc90a790a438ba8f9ee0 /crates/ra_hir/src/ty
parent45117c63884366ee82102a782a62a09fefff746b (diff)
generalize impl_froms to nested enums
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/lower.rs28
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}
614impl_froms!(TypableDef: Function, AdtDef, EnumVariant, TypeAlias, Const, Static, BuiltinType); 614impl_froms!(
615 615 TypableDef: Function,
616impl 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
622impl From<Enum> for TypableDef { 622);
623 fn from(it: Enum) -> TypableDef {
624 TypableDef::AdtDef(AdtDef::Enum(it))
625 }
626}
627
628impl From<Union> for TypableDef {
629 fn from(it: Union) -> TypableDef {
630 TypableDef::AdtDef(AdtDef::Union(it))
631 }
632}
633 623
634impl From<ModuleDef> for Option<TypableDef> { 624impl From<ModuleDef> for Option<TypableDef> {
635 fn from(def: ModuleDef) -> Option<TypableDef> { 625 fn from(def: ModuleDef) -> Option<TypableDef> {