diff options
author | Aleksey Kladov <[email protected]> | 2020-04-17 12:55:05 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-17 12:56:42 +0100 |
commit | 146f6f5a45a4bfd98ab0eb54bb30610d784433c9 (patch) | |
tree | e56f182d50f8863c2535fcd9d736ffb4e3425ae6 /crates/ra_hir_ty/src/expr.rs | |
parent | a8196ffe8466aa60dec56e77c2da717793c0debe (diff) |
Simplify Diagnostic structure
It's not entirely clear what subnode ranges should mean in the
presence of macros, so let's leave them out for now. We are not using
them heavily anyway.
Diffstat (limited to 'crates/ra_hir_ty/src/expr.rs')
-rw-r--r-- | crates/ra_hir_ty/src/expr.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs index 1d3950b70..fd59f4320 100644 --- a/crates/ra_hir_ty/src/expr.rs +++ b/crates/ra_hir_ty/src/expr.rs | |||
@@ -4,7 +4,7 @@ use std::sync::Arc; | |||
4 | 4 | ||
5 | use hir_def::{path::path, resolver::HasResolver, AdtId, FunctionId}; | 5 | use hir_def::{path::path, resolver::HasResolver, AdtId, FunctionId}; |
6 | use hir_expand::diagnostics::DiagnosticSink; | 6 | use hir_expand::diagnostics::DiagnosticSink; |
7 | use ra_syntax::{ast, AstNode, AstPtr}; | 7 | use ra_syntax::{ast, AstPtr}; |
8 | use rustc_hash::FxHashSet; | 8 | use rustc_hash::FxHashSet; |
9 | 9 | ||
10 | use crate::{ | 10 | use crate::{ |
@@ -100,7 +100,6 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
100 | self.sink.push(MissingFields { | 100 | self.sink.push(MissingFields { |
101 | file: source_ptr.file_id, | 101 | file: source_ptr.file_id, |
102 | field_list: AstPtr::new(&field_list), | 102 | field_list: AstPtr::new(&field_list), |
103 | highlight_range: field_list.syntax().text_range(), | ||
104 | missed_fields, | 103 | missed_fields, |
105 | }) | 104 | }) |
106 | } | 105 | } |
@@ -131,7 +130,6 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
131 | self.sink.push(MissingPatFields { | 130 | self.sink.push(MissingPatFields { |
132 | file: source_ptr.file_id, | 131 | file: source_ptr.file_id, |
133 | field_list: AstPtr::new(&field_list), | 132 | field_list: AstPtr::new(&field_list), |
134 | highlight_range: field_list.syntax().text_range(), | ||
135 | missed_fields, | 133 | missed_fields, |
136 | }) | 134 | }) |
137 | } | 135 | } |
@@ -215,7 +213,6 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
215 | file: source_ptr.file_id, | 213 | file: source_ptr.file_id, |
216 | match_expr: AstPtr::new(&match_expr), | 214 | match_expr: AstPtr::new(&match_expr), |
217 | arms: AstPtr::new(&arms), | 215 | arms: AstPtr::new(&arms), |
218 | highlight_range: match_expr.syntax().text_range(), | ||
219 | }) | 216 | }) |
220 | } | 217 | } |
221 | } | 218 | } |
@@ -247,13 +244,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
247 | let (_, source_map) = db.body_with_source_map(self.func.into()); | 244 | let (_, source_map) = db.body_with_source_map(self.func.into()); |
248 | 245 | ||
249 | if let Ok(source_ptr) = source_map.expr_syntax(id) { | 246 | if let Ok(source_ptr) = source_map.expr_syntax(id) { |
250 | let root = source_ptr.file_syntax(db.upcast()); | 247 | self.sink |
251 | let highlight_range = source_ptr.value.to_node(&root).syntax().text_range(); | 248 | .push(MissingOkInTailExpr { file: source_ptr.file_id, expr: source_ptr.value }); |
252 | self.sink.push(MissingOkInTailExpr { | ||
253 | file: source_ptr.file_id, | ||
254 | expr: source_ptr.value, | ||
255 | highlight_range, | ||
256 | }); | ||
257 | } | 249 | } |
258 | } | 250 | } |
259 | } | 251 | } |