diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/expr/validation.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index 339a7b848..f0da3d169 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs | |||
@@ -12,7 +12,7 @@ use crate::{ | |||
12 | name, | 12 | name, |
13 | path::{PathKind, PathSegment}, | 13 | path::{PathKind, PathSegment}, |
14 | ty::{InferenceResult, Ty, TypeCtor}, | 14 | ty::{InferenceResult, Ty, TypeCtor}, |
15 | Function, HasSource, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution | 15 | Function, HasSource, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution, |
16 | }; | 16 | }; |
17 | use ra_syntax::ast; | 17 | use ra_syntax::ast; |
18 | 18 | ||
@@ -116,26 +116,25 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
116 | PathSegment { name: name::STD, args_and_bindings: None }, | 116 | PathSegment { name: name::STD, args_and_bindings: None }, |
117 | PathSegment { name: name::RESULT_MOD, args_and_bindings: None }, | 117 | PathSegment { name: name::RESULT_MOD, args_and_bindings: None }, |
118 | PathSegment { name: name::RESULT_TYPE, args_and_bindings: None }, | 118 | PathSegment { name: name::RESULT_TYPE, args_and_bindings: None }, |
119 | ] | 119 | ], |
120 | }; | 120 | }; |
121 | 121 | ||
122 | let resolver = self.func.resolver(db); | 122 | let resolver = self.func.resolver(db); |
123 | let std_result_enum = match resolver.resolve_path_segments(db, &std_result_path).into_fully_resolved() { | 123 | let std_result_enum = |
124 | PerNs { types: Some(Resolution::Def(ModuleDef::Enum(e))), .. } => e, | 124 | match resolver.resolve_path_segments(db, &std_result_path).into_fully_resolved() { |
125 | _ => return, | 125 | PerNs { types: Some(Resolution::Def(ModuleDef::Enum(e))), .. } => e, |
126 | }; | 126 | _ => return, |
127 | }; | ||
127 | 128 | ||
128 | let std_result_type = std_result_enum.ty(db); | 129 | let std_result_type = std_result_enum.ty(db); |
129 | 130 | ||
130 | fn enum_from_type(ty: &Ty) -> Option<Enum> { | 131 | fn enum_from_type(ty: &Ty) -> Option<Enum> { |
131 | match ty { | 132 | match ty { |
132 | Ty::Apply(t) => { | 133 | Ty::Apply(t) => match t.ctor { |
133 | match t.ctor { | 134 | TypeCtor::Adt(AdtDef::Enum(e)) => Some(e), |
134 | TypeCtor::Adt(AdtDef::Enum(e)) => Some(e), | 135 | _ => None, |
135 | _ => None, | 136 | }, |
136 | } | 137 | _ => None, |
137 | } | ||
138 | _ => None | ||
139 | } | 138 | } |
140 | } | 139 | } |
141 | 140 | ||