Skip to content

Commit b7c4435

Browse files
committed
Don't unnecessarily query the ast_id_map for blocks if they aren't interned
1 parent a1b96b1 commit b7c4435

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/hir-def/src/body/lower.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -973,10 +973,10 @@ impl ExprCollector<'_> {
973973
block: ast::BlockExpr,
974974
mk_block: impl FnOnce(Option<BlockId>, Box<[Statement]>, Option<ExprId>) -> Expr,
975975
) -> ExprId {
976-
let file_local_id = self.ast_id_map.ast_id(&block);
977-
let ast_id = AstId::new(self.expander.current_file_id, file_local_id);
978-
979-
let block_id = if ItemTree::block_has_items(self.db, ast_id.file_id, &block) {
976+
let block_id = if ItemTree::block_has_items(self.db, self.expander.current_file_id, &block)
977+
{
978+
let file_local_id = self.ast_id_map.ast_id(&block);
979+
let ast_id = AstId::new(self.expander.current_file_id, file_local_id);
980980
Some(self.db.intern_block(BlockLoc {
981981
ast_id,
982982
module: self.expander.def_map.module_id(self.expander.module),

0 commit comments

Comments
 (0)