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