aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-15 15:33:26 +0000
committerAleksey Kladov <[email protected]>2019-01-15 15:33:26 +0000
commit8af9a18660f9b2f34da902f43c1eef856af1cfca (patch)
treee757ea3f647159de8ce49e43177e10c43f61d2bf /crates/ra_hir
parentc159e414b42e2fd43ed88bbf4113fbe8c8e372fe (diff)
remove Cancelable from Crate API
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model_api.rs6
-rw-r--r--crates/ra_hir/src/code_model_impl/krate.rs8
-rw-r--r--crates/ra_hir/src/nameres.rs4
-rw-r--r--crates/ra_hir/src/ty/method_resolution.rs2
4 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 81638e384..db270b871 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -33,10 +33,10 @@ impl Crate {
33 pub fn crate_id(&self) -> CrateId { 33 pub fn crate_id(&self) -> CrateId {
34 self.crate_id 34 self.crate_id
35 } 35 }
36 pub fn dependencies(&self, db: &impl HirDatabase) -> Cancelable<Vec<CrateDependency>> { 36 pub fn dependencies(&self, db: &impl HirDatabase) -> Vec<CrateDependency> {
37 Ok(self.dependencies_impl(db)) 37 self.dependencies_impl(db)
38 } 38 }
39 pub fn root_module(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { 39 pub fn root_module(&self, db: &impl HirDatabase) -> Option<Module> {
40 self.root_module_impl(db) 40 self.root_module_impl(db)
41 } 41 }
42} 42}
diff --git a/crates/ra_hir/src/code_model_impl/krate.rs b/crates/ra_hir/src/code_model_impl/krate.rs
index 712c6c86a..8c6e34873 100644
--- a/crates/ra_hir/src/code_model_impl/krate.rs
+++ b/crates/ra_hir/src/code_model_impl/krate.rs
@@ -1,4 +1,4 @@
1use ra_db::{CrateId, Cancelable}; 1use ra_db::CrateId;
2 2
3use crate::{ 3use crate::{
4 HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId, 4 HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId,
@@ -20,7 +20,7 @@ impl Crate {
20 }) 20 })
21 .collect() 21 .collect()
22 } 22 }
23 pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { 23 pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Option<Module> {
24 let crate_graph = db.crate_graph(); 24 let crate_graph = db.crate_graph();
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);
@@ -31,7 +31,7 @@ impl Crate {
31 file_id, 31 file_id,
32 item_id: None, 32 item_id: None,
33 }; 33 };
34 let module_id = ctry!(module_tree.find_module_by_source(source)); 34 let module_id = module_tree.find_module_by_source(source)?;
35 35
36 let def_loc = DefLoc { 36 let def_loc = DefLoc {
37 kind: DefKind::Module, 37 kind: DefKind::Module,
@@ -42,6 +42,6 @@ impl Crate {
42 let def_id = def_loc.id(db); 42 let def_id = def_loc.id(db);
43 43
44 let module = Module::new(def_id); 44 let module = Module::new(def_id);
45 Ok(Some(module)) 45 Some(module)
46 } 46 }
47} 47}
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index edb3b1e64..e51cbe786 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -353,8 +353,8 @@ where
353 if let Some(crate_id) = crate_graph.crate_id_for_crate_root(file_id.as_original_file()) 353 if let Some(crate_id) = crate_graph.crate_id_for_crate_root(file_id.as_original_file())
354 { 354 {
355 let krate = Crate::new(crate_id); 355 let krate = Crate::new(crate_id);
356 for dep in krate.dependencies(self.db)? { 356 for dep in krate.dependencies(self.db) {
357 if let Some(module) = dep.krate.root_module(self.db)? { 357 if let Some(module) = dep.krate.root_module(self.db) {
358 let def_id = module.def_id; 358 let def_id = module.def_id;
359 self.add_module_item( 359 self.add_module_item(
360 &mut module_items, 360 &mut module_items,
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index f0da2ee2b..c7fbcfd06 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -93,7 +93,7 @@ impl CrateImplBlocks {
93 source_root_id, 93 source_root_id,
94 impls: FxHashMap::default(), 94 impls: FxHashMap::default(),
95 }; 95 };
96 if let Some(module) = krate.root_module(db)? { 96 if let Some(module) = krate.root_module(db) {
97 crate_impl_blocks.collect_recursive(db, module)?; 97 crate_impl_blocks.collect_recursive(db, module)?;
98 } 98 }
99 Ok(Arc::new(crate_impl_blocks)) 99 Ok(Arc::new(crate_impl_blocks))