aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/diagnostics/expr.rs')
-rw-r--r--crates/hir_ty/src/diagnostics/expr.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs
index b2bfd68d4..71b2cade0 100644
--- a/crates/hir_ty/src/diagnostics/expr.rs
+++ b/crates/hir_ty/src/diagnostics/expr.rs
@@ -44,7 +44,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
44 pub(super) fn validate_body(&mut self, db: &dyn HirDatabase) { 44 pub(super) fn validate_body(&mut self, db: &dyn HirDatabase) {
45 self.check_for_filter_map_next(db); 45 self.check_for_filter_map_next(db);
46 46
47 let body = db.body(self.owner.into()); 47 let body = db.body(self.owner);
48 48
49 for (id, expr) in body.exprs.iter() { 49 for (id, expr) in body.exprs.iter() {
50 if let Some((variant_def, missed_fields, true)) = 50 if let Some((variant_def, missed_fields, true)) =
@@ -98,7 +98,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
98 missed_fields: Vec<LocalFieldId>, 98 missed_fields: Vec<LocalFieldId>,
99 ) { 99 ) {
100 // XXX: only look at source_map if we do have missing fields 100 // XXX: only look at source_map if we do have missing fields
101 let (_, source_map) = db.body_with_source_map(self.owner.into()); 101 let (_, source_map) = db.body_with_source_map(self.owner);
102 102
103 if let Ok(source_ptr) = source_map.expr_syntax(id) { 103 if let Ok(source_ptr) = source_map.expr_syntax(id) {
104 let root = source_ptr.file_syntax(db.upcast()); 104 let root = source_ptr.file_syntax(db.upcast());
@@ -128,7 +128,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
128 missed_fields: Vec<LocalFieldId>, 128 missed_fields: Vec<LocalFieldId>,
129 ) { 129 ) {
130 // XXX: only look at source_map if we do have missing fields 130 // XXX: only look at source_map if we do have missing fields
131 let (_, source_map) = db.body_with_source_map(self.owner.into()); 131 let (_, source_map) = db.body_with_source_map(self.owner);
132 132
133 if let Ok(source_ptr) = source_map.pat_syntax(id) { 133 if let Ok(source_ptr) = source_map.pat_syntax(id) {
134 if let Some(expr) = source_ptr.value.as_ref().left() { 134 if let Some(expr) = source_ptr.value.as_ref().left() {
@@ -175,7 +175,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
175 }; 175 };
176 176
177 // Search function body for instances of .filter_map(..).next() 177 // Search function body for instances of .filter_map(..).next()
178 let body = db.body(self.owner.into()); 178 let body = db.body(self.owner);
179 let mut prev = None; 179 let mut prev = None;
180 for (id, expr) in body.exprs.iter() { 180 for (id, expr) in body.exprs.iter() {
181 if let Expr::MethodCall { receiver, .. } = expr { 181 if let Expr::MethodCall { receiver, .. } = expr {
@@ -192,7 +192,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
192 if function_id == *next_function_id { 192 if function_id == *next_function_id {
193 if let Some(filter_map_id) = prev { 193 if let Some(filter_map_id) = prev {
194 if *receiver == filter_map_id { 194 if *receiver == filter_map_id {
195 let (_, source_map) = db.body_with_source_map(self.owner.into()); 195 let (_, source_map) = db.body_with_source_map(self.owner);
196 if let Ok(next_source_ptr) = source_map.expr_syntax(id) { 196 if let Ok(next_source_ptr) = source_map.expr_syntax(id) {
197 self.sink.push(ReplaceFilterMapNextWithFindMap { 197 self.sink.push(ReplaceFilterMapNextWithFindMap {
198 file: next_source_ptr.file_id, 198 file: next_source_ptr.file_id,
@@ -262,7 +262,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
262 let mut arg_count = args.len(); 262 let mut arg_count = args.len();
263 263
264 if arg_count != param_count { 264 if arg_count != param_count {
265 let (_, source_map) = db.body_with_source_map(self.owner.into()); 265 let (_, source_map) = db.body_with_source_map(self.owner);
266 if let Ok(source_ptr) = source_map.expr_syntax(call_id) { 266 if let Ok(source_ptr) = source_map.expr_syntax(call_id) {
267 if is_method_call { 267 if is_method_call {
268 param_count -= 1; 268 param_count -= 1;
@@ -287,7 +287,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
287 infer: Arc<InferenceResult>, 287 infer: Arc<InferenceResult>,
288 ) { 288 ) {
289 let (body, source_map): (Arc<Body>, Arc<BodySourceMap>) = 289 let (body, source_map): (Arc<Body>, Arc<BodySourceMap>) =
290 db.body_with_source_map(self.owner.into()); 290 db.body_with_source_map(self.owner);
291 291
292 let match_expr_ty = if infer.type_of_expr[match_expr].is_unknown() { 292 let match_expr_ty = if infer.type_of_expr[match_expr].is_unknown() {
293 return; 293 return;
@@ -393,7 +393,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
393 }; 393 };
394 394
395 if params.len() > 0 && params[0] == mismatch.actual { 395 if params.len() > 0 && params[0] == mismatch.actual {
396 let (_, source_map) = db.body_with_source_map(self.owner.into()); 396 let (_, source_map) = db.body_with_source_map(self.owner);
397 397
398 if let Ok(source_ptr) = source_map.expr_syntax(id) { 398 if let Ok(source_ptr) = source_map.expr_syntax(id) {
399 self.sink.push(MissingOkOrSomeInTailExpr { 399 self.sink.push(MissingOkOrSomeInTailExpr {
@@ -425,7 +425,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
425 return; 425 return;
426 } 426 }
427 427
428 let (_, source_map) = db.body_with_source_map(self.owner.into()); 428 let (_, source_map) = db.body_with_source_map(self.owner);
429 429
430 if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) { 430 if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) {
431 self.sink 431 self.sink