diff options
author | Jonas Schievink <[email protected]> | 2021-03-18 00:41:38 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-18 00:41:38 +0000 |
commit | b5cb2829a419dd6a82b320232fadf05d9f042390 (patch) | |
tree | b4d79d73f7a2fd98fa7a32b3da2040dba1008a77 /crates | |
parent | bda858bba941fe7e629366072e34f2292494cc68 (diff) |
Avoid cloning `CfgOptions`
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_def/src/data.rs | 5 |
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 | ||