aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/descriptors
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/descriptors')
-rw-r--r--crates/ra_analysis/src/descriptors/module/mod.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/crates/ra_analysis/src/descriptors/module/mod.rs b/crates/ra_analysis/src/descriptors/module/mod.rs
index 16faea94e..d0560244a 100644
--- a/crates/ra_analysis/src/descriptors/module/mod.rs
+++ b/crates/ra_analysis/src/descriptors/module/mod.rs
@@ -165,15 +165,6 @@ enum ModuleSourceNode {
165#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] 165#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
166pub(crate) struct ModuleId(u32); 166pub(crate) struct ModuleId(u32);
167 167
168impl crate::loc2id::NumericId for ModuleId {
169 fn from_u32(id: u32) -> Self {
170 ModuleId(id)
171 }
172 fn to_u32(self) -> u32 {
173 self.0
174 }
175}
176
177#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] 168#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
178struct LinkId(u32); 169struct LinkId(u32);
179 170
@@ -189,13 +180,13 @@ pub enum Problem {
189} 180}
190 181
191impl ModuleId { 182impl ModuleId {
192 pub(crate) fn source(self, tree: &ModuleTree) -> ModuleSource { 183 fn source(self, tree: &ModuleTree) -> ModuleSource {
193 tree.module(self).source 184 tree.module(self).source
194 } 185 }
195 fn parent_link(self, tree: &ModuleTree) -> Option<LinkId> { 186 fn parent_link(self, tree: &ModuleTree) -> Option<LinkId> {
196 tree.module(self).parent 187 tree.module(self).parent
197 } 188 }
198 pub(crate) fn parent(self, tree: &ModuleTree) -> Option<ModuleId> { 189 fn parent(self, tree: &ModuleTree) -> Option<ModuleId> {
199 let link = self.parent_link(tree)?; 190 let link = self.parent_link(tree)?;
200 Some(tree.link(link).owner) 191 Some(tree.link(link).owner)
201 } 192 }