aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/diagnostics
diff options
context:
space:
mode:
authorivan770 <[email protected]>2020-12-10 16:10:39 +0000
committerivan770 <[email protected]>2020-12-10 16:10:39 +0000
commitbbb0bc7b041278480edbfaa7c3cdadc5a704fc03 (patch)
treeba9a6ca1097cdce52d4d701effaabf8e1e2868fd /crates/hir_ty/src/diagnostics
parent35006eba79b9a445c4ebec66f1a93b3170398e0e (diff)
Cast to ExprStmt, style fixes
Diffstat (limited to 'crates/hir_ty/src/diagnostics')
-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 });