Skip to content

Commit 7beec8f

Browse files
Stop fetching ItemTrees for no reason
1 parent 654313d commit 7beec8f

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

crates/hir_def/src/body/lower.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr`
22
//! representation.
33
4-
use std::{mem, sync::Arc};
4+
use std::mem;
55

66
use either::Either;
77
use hir_expand::{
@@ -11,7 +11,6 @@ use hir_expand::{
1111
};
1212
use la_arena::Arena;
1313
use profile::Count;
14-
use rustc_hash::FxHashMap;
1514
use syntax::{
1615
ast::{
1716
self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner,
@@ -32,7 +31,6 @@ use crate::{
3231
Statement,
3332
},
3433
item_scope::BuiltinShadowMode,
35-
item_tree::ItemTree,
3634
path::{GenericArgs, Path},
3735
type_ref::{Mutability, Rawness, TypeRef},
3836
AdtId, BlockLoc, ModuleDefId,
@@ -63,7 +61,6 @@ pub(super) fn lower(
6361
params: Option<ast::ParamList>,
6462
body: Option<ast::Expr>,
6563
) -> (Body, BodySourceMap) {
66-
let item_tree = db.item_tree(expander.current_file_id);
6764
ExprCollector {
6865
db,
6966
source_map: BodySourceMap::default(),
@@ -76,11 +73,6 @@ pub(super) fn lower(
7673
block_scopes: Vec::new(),
7774
_c: Count::new(),
7875
},
79-
item_trees: {
80-
let mut map = FxHashMap::default();
81-
map.insert(expander.current_file_id, item_tree);
82-
map
83-
},
8476
expander,
8577
}
8678
.collect(params, body)
@@ -91,8 +83,6 @@ struct ExprCollector<'a> {
9183
expander: Expander,
9284
body: Body,
9385
source_map: BodySourceMap,
94-
95-
item_trees: FxHashMap<HirFileId, Arc<ItemTree>>,
9686
}
9787

9888
impl ExprCollector<'_> {
@@ -589,9 +579,6 @@ impl ExprCollector<'_> {
589579
} else {
590580
self.source_map.expansions.insert(macro_call, self.expander.current_file_id);
591581

592-
let item_tree = self.db.item_tree(self.expander.current_file_id);
593-
self.item_trees.insert(self.expander.current_file_id, item_tree);
594-
595582
let id = collector(self, Some(expansion));
596583
self.expander.exit(self.db, mark);
597584
id

0 commit comments

Comments
 (0)