From 7beec8fda186e525c0c2d660455a774eeda22e9d Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 10 Mar 2021 02:32:16 +0100 Subject: [PATCH] Stop fetching ItemTrees for no reason --- crates/hir_def/src/body/lower.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 4d79ab72cd8..8c8eb8007c7 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -1,7 +1,7 @@ //! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr` //! representation. -use std::{mem, sync::Arc}; +use std::mem; use either::Either; use hir_expand::{ @@ -11,7 +11,6 @@ }; use la_arena::Arena; use profile::Count; -use rustc_hash::FxHashMap; use syntax::{ ast::{ self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner, @@ -32,7 +31,6 @@ Statement, }, item_scope::BuiltinShadowMode, - item_tree::ItemTree, path::{GenericArgs, Path}, type_ref::{Mutability, Rawness, TypeRef}, AdtId, BlockLoc, ModuleDefId, @@ -63,7 +61,6 @@ pub(super) fn lower( params: Option, body: Option, ) -> (Body, BodySourceMap) { - let item_tree = db.item_tree(expander.current_file_id); ExprCollector { db, source_map: BodySourceMap::default(), @@ -76,11 +73,6 @@ pub(super) fn lower( block_scopes: Vec::new(), _c: Count::new(), }, - item_trees: { - let mut map = FxHashMap::default(); - map.insert(expander.current_file_id, item_tree); - map - }, expander, } .collect(params, body) @@ -91,8 +83,6 @@ struct ExprCollector<'a> { expander: Expander, body: Body, source_map: BodySourceMap, - - item_trees: FxHashMap>, } impl ExprCollector<'_> { @@ -589,9 +579,6 @@ fn collect_macro_call), T: ast::AstNode>( } else { self.source_map.expansions.insert(macro_call, self.expander.current_file_id); - let item_tree = self.db.item_tree(self.expander.current_file_id); - self.item_trees.insert(self.expander.current_file_id, item_tree); - let id = collector(self, Some(expansion)); self.expander.exit(self.db, mark); id