From b6fcd462781826795e6ab32a69cd332496b537c2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 25 Nov 2018 19:02:14 +0300 Subject: Codify Arena pattern --- crates/ra_analysis/src/descriptors/module/imp.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'crates/ra_analysis/src/descriptors/module/imp.rs') 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>( db: &impl DescriptorDatabase, source_root: SourceRootId, ) -> Cancelable { - let mut tree = ModuleTree { - mods: Vec::new(), - links: Vec::new(), - }; + let mut tree = ModuleTree::default(); let mut roots = FxHashMap::default(); let mut visited = FxHashSet::default(); @@ -154,7 +151,7 @@ fn build_subtree( .into_iter() .map(|file_id| match roots.remove(&file_id) { Some(module_id) => { - tree.module_mut(module_id).parent = Some(link); + tree.mods[module_id].parent = Some(link); Ok(module_id) } None => build_subtree( @@ -184,8 +181,8 @@ fn build_subtree( } }; - tree.link_mut(link).points_to = points_to; - tree.link_mut(link).problem = problem; + tree.links[link].points_to = points_to; + tree.links[link].problem = problem; } Ok(id) } -- cgit v1.2.3