aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr
diff options
context:
space:
mode:
authorPhil Ellison <[email protected]>2019-08-11 15:04:08 +0100
committerAleksey Kladov <[email protected]>2019-08-25 10:55:56 +0100
commit4f6f3933ec04df55a39368d591c91cf81d980237 (patch)
treead9d77f715652be53185c9efa9ebff683ac4c5c0 /crates/ra_hir/src/expr
parent456e72c4e472d9ea0717c64a75bd02e94b6e90e8 (diff)
cargo format
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r--crates/ra_hir/src/expr/validation.rs25
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};
17use ra_syntax::ast; 17use 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