aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty')
-rw-r--r--crates/hir_ty/src/diagnostics/expr.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/hir_ty/src/diagnostics/expr.rs b/crates/hir_ty/src/diagnostics/expr.rs
index 9e461e0b0..849415706 100644
--- a/crates/hir_ty/src/diagnostics/expr.rs
+++ b/crates/hir_ty/src/diagnostics/expr.rs
@@ -334,18 +334,17 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
334 None => return, 334 None => return,
335 }; 335 };
336 336
337 let possible_tail_ty = 337 let possible_tail_ty = match self.infer.type_of_expr.get(possible_tail_id) {
338 if let Some(possible_tail_ty) = self.infer.type_of_expr.get(possible_tail_id) { 338 Some(ty) => ty,
339 possible_tail_ty 339 None => return,
340 } else { 340 };
341 return;
342 };
343 341
344 if mismatch.actual != Ty::unit() || mismatch.expected != *possible_tail_ty { 342 if mismatch.actual != Ty::unit() || mismatch.expected != *possible_tail_ty {
345 return; 343 return;
346 } 344 }
347 345
348 let (_, source_map) = db.body_with_source_map(self.owner.into()); 346 let (_, source_map) = db.body_with_source_map(self.owner.into());
347
349 if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) { 348 if let Ok(source_ptr) = source_map.expr_syntax(possible_tail_id) {
350 self.sink 349 self.sink
351 .push(RemoveThisSemicolon { file: source_ptr.file_id, expr: source_ptr.value }); 350 .push(RemoveThisSemicolon { file: source_ptr.file_id, expr: source_ptr.value });