aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/body
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/body')
-rw-r--r--crates/hir_def/src/body/lower.rs7
-rw-r--r--crates/hir_def/src/body/tests.rs9
2 files changed, 6 insertions, 10 deletions
diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs
index bed4c4994..f6e6cdbe2 100644
--- a/crates/hir_def/src/body/lower.rs
+++ b/crates/hir_def/src/body/lower.rs
@@ -690,9 +690,7 @@ impl ExprCollector<'_> {
690 } 690 }
691 } 691 }
692 ast::Stmt::Item(item) => { 692 ast::Stmt::Item(item) => {
693 if self.check_cfg(&item).is_none() { 693 self.check_cfg(&item);
694 return;
695 }
696 } 694 }
697 } 695 }
698 } 696 }
@@ -717,7 +715,8 @@ impl ExprCollector<'_> {
717 block.statements().for_each(|s| self.collect_stmt(s)); 715 block.statements().for_each(|s| self.collect_stmt(s));
718 block.tail_expr().and_then(|e| { 716 block.tail_expr().and_then(|e| {
719 let expr = self.maybe_collect_expr(e)?; 717 let expr = self.maybe_collect_expr(e)?;
720 Some(self.statements_in_scope.push(Statement::Expr { expr, has_semi: false })) 718 self.statements_in_scope.push(Statement::Expr { expr, has_semi: false });
719 Some(())
721 }); 720 });
722 721
723 let mut tail = None; 722 let mut tail = None;
diff --git a/crates/hir_def/src/body/tests.rs b/crates/hir_def/src/body/tests.rs
index 27d837d47..673a75386 100644
--- a/crates/hir_def/src/body/tests.rs
+++ b/crates/hir_def/src/body/tests.rs
@@ -15,12 +15,9 @@ fn lower(ra_fixture: &str) -> Arc<Body> {
15 let mut fn_def = None; 15 let mut fn_def = None;
16 'outer: for (_, module) in def_map.modules() { 16 'outer: for (_, module) in def_map.modules() {
17 for decl in module.scope.declarations() { 17 for decl in module.scope.declarations() {
18 match decl { 18 if let ModuleDefId::FunctionId(it) = decl {
19 ModuleDefId::FunctionId(it) => { 19 fn_def = Some(it);
20 fn_def = Some(it); 20 break 'outer;
21 break 'outer;
22 }
23 _ => {}
24 } 21 }
25 } 22 }
26 } 23 }