diff options
author | Aleksey Kladov <[email protected]> | 2019-01-15 14:55:15 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-15 14:55:15 +0000 |
commit | 68ff52566d44e916868de1b52a9688182c26ebde (patch) | |
tree | e5776811753f66c50d98dd155199c9cadd6b2bfb /crates/ra_hir/src/code_model_impl | |
parent | 443ff27724855ffbfccad3513bb82d59e1a4f8ae (diff) |
remove Cancelable from module_tree_query
Diffstat (limited to 'crates/ra_hir/src/code_model_impl')
-rw-r--r-- | crates/ra_hir/src/code_model_impl/krate.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model_impl/module.rs | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/crates/ra_hir/src/code_model_impl/krate.rs b/crates/ra_hir/src/code_model_impl/krate.rs index 3275eafed..712c6c86a 100644 --- a/crates/ra_hir/src/code_model_impl/krate.rs +++ b/crates/ra_hir/src/code_model_impl/krate.rs | |||
@@ -25,7 +25,7 @@ impl Crate { | |||
25 | let file_id = crate_graph.crate_root(self.crate_id); | 25 | let file_id = crate_graph.crate_root(self.crate_id); |
26 | let source_root_id = db.file_source_root(file_id); | 26 | let source_root_id = db.file_source_root(file_id); |
27 | let file_id = HirFileId::from(file_id); | 27 | let file_id = HirFileId::from(file_id); |
28 | let module_tree = db.module_tree(source_root_id)?; | 28 | let module_tree = db.module_tree(source_root_id); |
29 | // FIXME: teach module tree about crate roots instead of guessing | 29 | // FIXME: teach module tree about crate roots instead of guessing |
30 | let source = SourceItemId { | 30 | let source = SourceItemId { |
31 | file_id, | 31 | file_id, |
diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 775dd6709..2ec3ab469 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs | |||
@@ -19,7 +19,7 @@ impl Module { | |||
19 | source_root_id: SourceRootId, | 19 | source_root_id: SourceRootId, |
20 | module_id: ModuleId, | 20 | module_id: ModuleId, |
21 | ) -> Cancelable<Self> { | 21 | ) -> Cancelable<Self> { |
22 | let module_tree = db.module_tree(source_root_id)?; | 22 | let module_tree = db.module_tree(source_root_id); |
23 | let def_loc = DefLoc { | 23 | let def_loc = DefLoc { |
24 | kind: DefKind::Module, | 24 | kind: DefKind::Module, |
25 | source_root_id, | 25 | source_root_id, |
@@ -33,7 +33,7 @@ impl Module { | |||
33 | 33 | ||
34 | pub(crate) fn name_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { | 34 | pub(crate) fn name_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Name>> { |
35 | let loc = self.def_id.loc(db); | 35 | let loc = self.def_id.loc(db); |
36 | let module_tree = db.module_tree(loc.source_root_id)?; | 36 | let module_tree = db.module_tree(loc.source_root_id); |
37 | let link = ctry!(loc.module_id.parent_link(&module_tree)); | 37 | let link = ctry!(loc.module_id.parent_link(&module_tree)); |
38 | Ok(Some(link.name(&module_tree).clone())) | 38 | Ok(Some(link.name(&module_tree).clone())) |
39 | } | 39 | } |
@@ -59,7 +59,7 @@ impl Module { | |||
59 | db: &impl HirDatabase, | 59 | db: &impl HirDatabase, |
60 | ) -> Cancelable<Option<(FileId, TreeArc<ast::Module>)>> { | 60 | ) -> Cancelable<Option<(FileId, TreeArc<ast::Module>)>> { |
61 | let loc = self.def_id.loc(db); | 61 | let loc = self.def_id.loc(db); |
62 | let module_tree = db.module_tree(loc.source_root_id)?; | 62 | let module_tree = db.module_tree(loc.source_root_id); |
63 | let link = ctry!(loc.module_id.parent_link(&module_tree)); | 63 | let link = ctry!(loc.module_id.parent_link(&module_tree)); |
64 | let file_id = link | 64 | let file_id = link |
65 | .owner(&module_tree) | 65 | .owner(&module_tree) |
@@ -82,7 +82,7 @@ impl Module { | |||
82 | 82 | ||
83 | pub(crate) fn crate_root_impl(&self, db: &impl HirDatabase) -> Cancelable<Module> { | 83 | pub(crate) fn crate_root_impl(&self, db: &impl HirDatabase) -> Cancelable<Module> { |
84 | let loc = self.def_id.loc(db); | 84 | let loc = self.def_id.loc(db); |
85 | let module_tree = db.module_tree(loc.source_root_id)?; | 85 | let module_tree = db.module_tree(loc.source_root_id); |
86 | let module_id = loc.module_id.crate_root(&module_tree); | 86 | let module_id = loc.module_id.crate_root(&module_tree); |
87 | Module::from_module_id(db, loc.source_root_id, module_id) | 87 | Module::from_module_id(db, loc.source_root_id, module_id) |
88 | } | 88 | } |
@@ -90,7 +90,7 @@ impl Module { | |||
90 | /// Finds a child module with the specified name. | 90 | /// Finds a child module with the specified name. |
91 | pub fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> { | 91 | pub fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> { |
92 | let loc = self.def_id.loc(db); | 92 | let loc = self.def_id.loc(db); |
93 | let module_tree = db.module_tree(loc.source_root_id)?; | 93 | let module_tree = db.module_tree(loc.source_root_id); |
94 | let child_id = ctry!(loc.module_id.child(&module_tree, name)); | 94 | let child_id = ctry!(loc.module_id.child(&module_tree, name)); |
95 | Module::from_module_id(db, loc.source_root_id, child_id).map(Some) | 95 | Module::from_module_id(db, loc.source_root_id, child_id).map(Some) |
96 | } | 96 | } |
@@ -101,7 +101,7 @@ impl Module { | |||
101 | // it's kind of hard since the iterator needs to keep a reference to the | 101 | // it's kind of hard since the iterator needs to keep a reference to the |
102 | // module tree. | 102 | // module tree. |
103 | let loc = self.def_id.loc(db); | 103 | let loc = self.def_id.loc(db); |
104 | let module_tree = db.module_tree(loc.source_root_id)?; | 104 | let module_tree = db.module_tree(loc.source_root_id); |
105 | let children = loc | 105 | let children = loc |
106 | .module_id | 106 | .module_id |
107 | .children(&module_tree) | 107 | .children(&module_tree) |
@@ -112,7 +112,7 @@ impl Module { | |||
112 | 112 | ||
113 | pub fn parent_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { | 113 | pub fn parent_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { |
114 | let loc = self.def_id.loc(db); | 114 | let loc = self.def_id.loc(db); |
115 | let module_tree = db.module_tree(loc.source_root_id)?; | 115 | let module_tree = db.module_tree(loc.source_root_id); |
116 | let parent_id = ctry!(loc.module_id.parent(&module_tree)); | 116 | let parent_id = ctry!(loc.module_id.parent(&module_tree)); |
117 | Module::from_module_id(db, loc.source_root_id, parent_id).map(Some) | 117 | Module::from_module_id(db, loc.source_root_id, parent_id).map(Some) |
118 | } | 118 | } |
@@ -190,7 +190,7 @@ impl Module { | |||
190 | db: &impl HirDatabase, | 190 | db: &impl HirDatabase, |
191 | ) -> Cancelable<Vec<(TreeArc<SyntaxNode>, Problem)>> { | 191 | ) -> Cancelable<Vec<(TreeArc<SyntaxNode>, Problem)>> { |
192 | let loc = self.def_id.loc(db); | 192 | let loc = self.def_id.loc(db); |
193 | let module_tree = db.module_tree(loc.source_root_id)?; | 193 | let module_tree = db.module_tree(loc.source_root_id); |
194 | Ok(loc.module_id.problems(&module_tree, db)) | 194 | Ok(loc.module_id.problems(&module_tree, db)) |
195 | } | 195 | } |
196 | } | 196 | } |