diff options
Diffstat (limited to 'crates/ra_analysis/src/descriptors')
-rw-r--r-- | crates/ra_analysis/src/descriptors/function/scope.rs | 4 | ||||
-rw-r--r-- | crates/ra_analysis/src/descriptors/module/mod.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/descriptors/function/scope.rs b/crates/ra_analysis/src/descriptors/function/scope.rs index 54d7fa456..5307a0a8e 100644 --- a/crates/ra_analysis/src/descriptors/function/scope.rs +++ b/crates/ra_analysis/src/descriptors/function/scope.rs | |||
@@ -58,13 +58,13 @@ impl FnScopes { | |||
58 | }) | 58 | }) |
59 | } | 59 | } |
60 | fn root_scope(&mut self) -> ScopeId { | 60 | fn root_scope(&mut self) -> ScopeId { |
61 | self.scopes.push(ScopeData { | 61 | self.scopes.alloc(ScopeData { |
62 | parent: None, | 62 | parent: None, |
63 | entries: vec![], | 63 | entries: vec![], |
64 | }) | 64 | }) |
65 | } | 65 | } |
66 | fn new_scope(&mut self, parent: ScopeId) -> ScopeId { | 66 | fn new_scope(&mut self, parent: ScopeId) -> ScopeId { |
67 | self.scopes.push(ScopeData { | 67 | self.scopes.alloc(ScopeData { |
68 | parent: Some(parent), | 68 | parent: Some(parent), |
69 | entries: vec![], | 69 | entries: vec![], |
70 | }) | 70 | }) |
diff --git a/crates/ra_analysis/src/descriptors/module/mod.rs b/crates/ra_analysis/src/descriptors/module/mod.rs index 54ff95b66..a6eaec178 100644 --- a/crates/ra_analysis/src/descriptors/module/mod.rs +++ b/crates/ra_analysis/src/descriptors/module/mod.rs | |||
@@ -166,12 +166,12 @@ pub(crate) struct ModuleTree { | |||
166 | 166 | ||
167 | impl ModuleTree { | 167 | impl ModuleTree { |
168 | fn modules<'a>(&'a self) -> impl Iterator<Item = ModuleId> + 'a { | 168 | fn modules<'a>(&'a self) -> impl Iterator<Item = ModuleId> + 'a { |
169 | self.mods.keys() | 169 | self.mods.iter().map(|(id, _)| id) |
170 | } | 170 | } |
171 | 171 | ||
172 | fn modules_for_source(&self, source: ModuleSource) -> Vec<ModuleId> { | 172 | fn modules_for_source(&self, source: ModuleSource) -> Vec<ModuleId> { |
173 | self.mods | 173 | self.mods |
174 | .items() | 174 | .iter() |
175 | .filter(|(_idx, it)| it.source == source) | 175 | .filter(|(_idx, it)| it.source == source) |
176 | .map(|(idx, _)| idx) | 176 | .map(|(idx, _)| idx) |
177 | .collect() | 177 | .collect() |
@@ -333,11 +333,11 @@ struct LinkData { | |||
333 | 333 | ||
334 | impl ModuleTree { | 334 | impl ModuleTree { |
335 | fn push_mod(&mut self, data: ModuleData) -> ModuleId { | 335 | fn push_mod(&mut self, data: ModuleData) -> ModuleId { |
336 | self.mods.push(data) | 336 | self.mods.alloc(data) |
337 | } | 337 | } |
338 | fn push_link(&mut self, data: LinkData) -> LinkId { | 338 | fn push_link(&mut self, data: LinkData) -> LinkId { |
339 | let owner = data.owner; | 339 | let owner = data.owner; |
340 | let id = self.links.push(data); | 340 | let id = self.links.alloc(data); |
341 | self.mods[owner].children.push(id); | 341 | self.mods[owner].children.push(id); |
342 | id | 342 | id |
343 | } | 343 | } |