diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/expr/validation.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs index fce1c2f14..e35990d2e 100644 --- a/crates/ra_hir/src/expr/validation.rs +++ b/crates/ra_hir/src/expr/validation.rs | |||
@@ -145,21 +145,10 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
145 | if params.len() == 2 && ¶ms[0] == &mismatch.actual { | 145 | if params.len() == 2 && ¶ms[0] == &mismatch.actual { |
146 | let source_map = self.func.body_source_map(db); | 146 | let source_map = self.func.body_source_map(db); |
147 | let file_id = self.func.source(db).file_id; | 147 | let file_id = self.func.source(db).file_id; |
148 | let parse = db.parse(file_id.original_file(db)); | ||
149 | let source_file = parse.tree(); | ||
150 | let expr_syntax = source_map.expr_syntax(id); | ||
151 | if expr_syntax.is_none() { | ||
152 | return; | ||
153 | } | ||
154 | let expr_syntax = expr_syntax.unwrap(); | ||
155 | let node = expr_syntax.to_node(source_file.syntax()); | ||
156 | let ast = ast::Expr::cast(node); | ||
157 | if ast.is_none() { | ||
158 | return; | ||
159 | } | ||
160 | let ast = ast.unwrap(); | ||
161 | 148 | ||
162 | self.sink.push(MissingOkInTailExpr { file: file_id, expr: AstPtr::new(&ast) }); | 149 | if let Some(expr) = source_map.expr_syntax(id).and_then(|n| n.cast::<ast::Expr>()) { |
150 | self.sink.push(MissingOkInTailExpr { file: file_id, expr }); | ||
151 | } | ||
163 | } | 152 | } |
164 | } | 153 | } |
165 | } | 154 | } |