aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr/validation.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-09-02 19:23:19 +0100
committerAleksey Kladov <[email protected]>2019-09-02 19:23:19 +0100
commit5e3f291195b580580be7ce5622f54ebca75fb9f0 (patch)
tree772693eb44bde1fac1b9292456e1fa6e056bdb1f /crates/ra_hir/src/expr/validation.rs
parentdcf8e895038a7677711b8168ee12e1d47f6018bc (diff)
fix hir for new block syntax
Diffstat (limited to 'crates/ra_hir/src/expr/validation.rs')
-rw-r--r--crates/ra_hir/src/expr/validation.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_hir/src/expr/validation.rs b/crates/ra_hir/src/expr/validation.rs
index c8ae19869..6fdaf1fce 100644
--- a/crates/ra_hir/src/expr/validation.rs
+++ b/crates/ra_hir/src/expr/validation.rs
@@ -1,7 +1,7 @@
1use rustc_hash::FxHashSet;
2use std::sync::Arc; 1use std::sync::Arc;
3 2
4use ra_syntax::ast::{AstNode, RecordLit}; 3use ra_syntax::ast::{self, AstNode};
4use rustc_hash::FxHashSet;
5 5
6use super::{Expr, ExprId, RecordLitField}; 6use super::{Expr, ExprId, RecordLitField};
7use crate::{ 7use crate::{
@@ -13,7 +13,6 @@ use crate::{
13 ty::{ApplicationTy, InferenceResult, Ty, TypeCtor}, 13 ty::{ApplicationTy, InferenceResult, Ty, TypeCtor},
14 Function, HasSource, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution, 14 Function, HasSource, HirDatabase, ModuleDef, Name, Path, PerNs, Resolution,
15}; 15};
16use ra_syntax::ast;
17 16
18pub(crate) struct ExprValidator<'a, 'b: 'a> { 17pub(crate) struct ExprValidator<'a, 'b: 'a> {
19 func: Function, 18 func: Function,
@@ -84,8 +83,12 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
84 let source_file = parse.tree(); 83 let source_file = parse.tree();
85 if let Some(field_list_node) = source_map 84 if let Some(field_list_node) = source_map
86 .expr_syntax(id) 85 .expr_syntax(id)
86 .and_then(|ptr| ptr.a())
87 .map(|ptr| ptr.to_node(source_file.syntax())) 87 .map(|ptr| ptr.to_node(source_file.syntax()))
88 .and_then(RecordLit::cast) 88 .and_then(|expr| match expr {
89 ast::Expr::RecordLit(it) => Some(it),
90 _ => None,
91 })
89 .and_then(|lit| lit.record_field_list()) 92 .and_then(|lit| lit.record_field_list())
90 { 93 {
91 let field_list_ptr = AstPtr::new(&field_list_node); 94 let field_list_ptr = AstPtr::new(&field_list_node);
@@ -135,7 +138,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
135 let source_map = self.func.body_source_map(db); 138 let source_map = self.func.body_source_map(db);
136 let file_id = self.func.source(db).file_id; 139 let file_id = self.func.source(db).file_id;
137 140
138 if let Some(expr) = source_map.expr_syntax(id).and_then(|n| n.cast::<ast::Expr>()) { 141 if let Some(expr) = source_map.expr_syntax(id).and_then(|n| n.a()) {
139 self.sink.push(MissingOkInTailExpr { file: file_id, expr }); 142 self.sink.push(MissingOkInTailExpr { file: file_id, expr });
140 } 143 }
141 } 144 }