diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-25 16:03:13 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-11-25 16:03:13 +0000 |
commit | 8a572043e7effe1d0b36a0d247960111312edc2a (patch) | |
tree | bb44eaedf546e20a8b29b9b421fb0c3accc1ce74 /crates/ra_analysis/src/descriptors/module/imp.rs | |
parent | 8f5fb8341314e94b1d91afa50ca895f78180f948 (diff) | |
parent | b6fcd462781826795e6ab32a69cd332496b537c2 (diff) |
Merge #242
242: Codify Arena pattern r=matklad a=matklad
bors r+
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/descriptors/module/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/imp.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/imp.rs b/crates/ra_analysis/src/descriptors/module/imp.rs index d4dce861f..80892acb7 100644 --- a/crates/ra_analysis/src/descriptors/module/imp.rs +++ b/crates/ra_analysis/src/descriptors/module/imp.rs | |||
@@ -94,10 +94,7 @@ fn create_module_tree<'a>( | |||
94 | db: &impl DescriptorDatabase, | 94 | db: &impl DescriptorDatabase, |
95 | source_root: SourceRootId, | 95 | source_root: SourceRootId, |
96 | ) -> Cancelable<ModuleTree> { | 96 | ) -> Cancelable<ModuleTree> { |
97 | let mut tree = ModuleTree { | 97 | let mut tree = ModuleTree::default(); |
98 | mods: Vec::new(), | ||
99 | links: Vec::new(), | ||
100 | }; | ||
101 | 98 | ||
102 | let mut roots = FxHashMap::default(); | 99 | let mut roots = FxHashMap::default(); |
103 | let mut visited = FxHashSet::default(); | 100 | let mut visited = FxHashSet::default(); |
@@ -154,7 +151,7 @@ fn build_subtree( | |||
154 | .into_iter() | 151 | .into_iter() |
155 | .map(|file_id| match roots.remove(&file_id) { | 152 | .map(|file_id| match roots.remove(&file_id) { |
156 | Some(module_id) => { | 153 | Some(module_id) => { |
157 | tree.module_mut(module_id).parent = Some(link); | 154 | tree.mods[module_id].parent = Some(link); |
158 | Ok(module_id) | 155 | Ok(module_id) |
159 | } | 156 | } |
160 | None => build_subtree( | 157 | None => build_subtree( |
@@ -184,8 +181,8 @@ fn build_subtree( | |||
184 | } | 181 | } |
185 | }; | 182 | }; |
186 | 183 | ||
187 | tree.link_mut(link).points_to = points_to; | 184 | tree.links[link].points_to = points_to; |
188 | tree.link_mut(link).problem = problem; | 185 | tree.links[link].problem = problem; |
189 | } | 186 | } |
190 | Ok(id) | 187 | Ok(id) |
191 | } | 188 | } |