From b5cb2829a419dd6a82b320232fadf05d9f042390 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 18 Mar 2021 01:41:38 +0100 Subject: Avoid cloning `CfgOptions` --- crates/hir_def/src/data.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/hir_def/src') diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs index 2c70b3bc0..fefc31129 100644 --- a/crates/hir_def/src/data.rs +++ b/crates/hir_def/src/data.rs @@ -252,12 +252,13 @@ fn collect_items( } let item_tree = db.item_tree(file_id); - let cfg_options = db.crate_graph()[module.krate].cfg_options.clone(); + let crate_graph = db.crate_graph(); + let cfg_options = &crate_graph[module.krate].cfg_options; let mut items = Vec::new(); for item in assoc_items { let attrs = item_tree.attrs(db, module.krate, ModItem::from(item).into()); - if !attrs.is_cfg_enabled(&cfg_options) { + if !attrs.is_cfg_enabled(cfg_options) { continue; } -- cgit v1.2.3