diff options
Diffstat (limited to 'crates/ra_hir_def/src/body/lower.rs')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 8d4b8b0f0..8338414fa 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -482,14 +482,17 @@ impl ExprCollector<'_> { | |||
482 | self.collect_block_items(&block); | 482 | self.collect_block_items(&block); |
483 | let statements = block | 483 | let statements = block |
484 | .statements() | 484 | .statements() |
485 | .map(|s| match s { | 485 | .filter_map(|s| match s { |
486 | ast::Stmt::LetStmt(stmt) => { | 486 | ast::Stmt::LetStmt(stmt) => { |
487 | let pat = self.collect_pat_opt(stmt.pat()); | 487 | let pat = self.collect_pat_opt(stmt.pat()); |
488 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); | 488 | let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); |
489 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); | 489 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); |
490 | Statement::Let { pat, type_ref, initializer } | 490 | Some(Statement::Let { pat, type_ref, initializer }) |
491 | } | 491 | } |
492 | ast::Stmt::ExprStmt(stmt) => Statement::Expr(self.collect_expr_opt(stmt.expr())), | 492 | ast::Stmt::ExprStmt(stmt) => { |
493 | Some(Statement::Expr(self.collect_expr_opt(stmt.expr()))) | ||
494 | } | ||
495 | ast::Stmt::ModuleItem(_) => None, | ||
493 | }) | 496 | }) |
494 | .collect(); | 497 | .collect(); |
495 | let tail = block.expr().map(|e| self.collect_expr(e)); | 498 | let tail = block.expr().map(|e| self.collect_expr(e)); |
@@ -541,6 +544,7 @@ impl ExprCollector<'_> { | |||
541 | let ast_id = self.expander.ast_id(&def); | 544 | let ast_id = self.expander.ast_id(&def); |
542 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) | 545 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) |
543 | } | 546 | } |
547 | ast::ModuleItem::ExternBlock(_) => continue, // FIXME: collect from extern blocks | ||
544 | ast::ModuleItem::ImplDef(_) | 548 | ast::ModuleItem::ImplDef(_) |
545 | | ast::ModuleItem::UseItem(_) | 549 | | ast::ModuleItem::UseItem(_) |
546 | | ast::ModuleItem::ExternCrateItem(_) | 550 | | ast::ModuleItem::ExternCrateItem(_) |