diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-18 00:43:18 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-18 00:43:18 +0000 |
commit | 5632e61f79ff8827816ccfab9f01ce2e349f3144 (patch) | |
tree | b4d79d73f7a2fd98fa7a32b3da2040dba1008a77 | |
parent | bda858bba941fe7e629366072e34f2292494cc68 (diff) | |
parent | b5cb2829a419dd6a82b320232fadf05d9f042390 (diff) |
Merge #8079
8079: Avoid cloning `CfgOptions` r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
-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 | ||