aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-18 00:41:38 +0000
committerJonas Schievink <[email protected]>2021-03-18 00:41:38 +0000
commitb5cb2829a419dd6a82b320232fadf05d9f042390 (patch)
treeb4d79d73f7a2fd98fa7a32b3da2040dba1008a77 /crates
parentbda858bba941fe7e629366072e34f2292494cc68 (diff)
Avoid cloning `CfgOptions`
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_def/src/data.rs5
1 files changed, 3 insertions, 2 deletions
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(
252 } 252 }
253 253
254 let item_tree = db.item_tree(file_id); 254 let item_tree = db.item_tree(file_id);
255 let cfg_options = db.crate_graph()[module.krate].cfg_options.clone(); 255 let crate_graph = db.crate_graph();
256 let cfg_options = &crate_graph[module.krate].cfg_options;
256 257
257 let mut items = Vec::new(); 258 let mut items = Vec::new();
258 for item in assoc_items { 259 for item in assoc_items {
259 let attrs = item_tree.attrs(db, module.krate, ModItem::from(item).into()); 260 let attrs = item_tree.attrs(db, module.krate, ModItem::from(item).into());
260 if !attrs.is_cfg_enabled(&cfg_options) { 261 if !attrs.is_cfg_enabled(cfg_options) {
261 continue; 262 continue;
262 } 263 }
263 264