mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 13:13:40 +00:00
remove Cancelable from Crate API
This commit is contained in:
parent
c159e414b4
commit
8af9a18660
@ -33,10 +33,10 @@ impl Crate {
|
||||
pub fn crate_id(&self) -> CrateId {
|
||||
self.crate_id
|
||||
}
|
||||
pub fn dependencies(&self, db: &impl HirDatabase) -> Cancelable<Vec<CrateDependency>> {
|
||||
Ok(self.dependencies_impl(db))
|
||||
pub fn dependencies(&self, db: &impl HirDatabase) -> Vec<CrateDependency> {
|
||||
self.dependencies_impl(db)
|
||||
}
|
||||
pub fn root_module(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> {
|
||||
pub fn root_module(&self, db: &impl HirDatabase) -> Option<Module> {
|
||||
self.root_module_impl(db)
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use ra_db::{CrateId, Cancelable};
|
||||
use ra_db::CrateId;
|
||||
|
||||
use crate::{
|
||||
HirFileId, Crate, CrateDependency, AsName, DefLoc, DefKind, Module, SourceItemId,
|
||||
@ -20,7 +20,7 @@ impl Crate {
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> {
|
||||
pub(crate) fn root_module_impl(&self, db: &impl HirDatabase) -> Option<Module> {
|
||||
let crate_graph = db.crate_graph();
|
||||
let file_id = crate_graph.crate_root(self.crate_id);
|
||||
let source_root_id = db.file_source_root(file_id);
|
||||
@ -31,7 +31,7 @@ impl Crate {
|
||||
file_id,
|
||||
item_id: None,
|
||||
};
|
||||
let module_id = ctry!(module_tree.find_module_by_source(source));
|
||||
let module_id = module_tree.find_module_by_source(source)?;
|
||||
|
||||
let def_loc = DefLoc {
|
||||
kind: DefKind::Module,
|
||||
@ -42,6 +42,6 @@ impl Crate {
|
||||
let def_id = def_loc.id(db);
|
||||
|
||||
let module = Module::new(def_id);
|
||||
Ok(Some(module))
|
||||
Some(module)
|
||||
}
|
||||
}
|
||||
|
@ -353,8 +353,8 @@ where
|
||||
if let Some(crate_id) = crate_graph.crate_id_for_crate_root(file_id.as_original_file())
|
||||
{
|
||||
let krate = Crate::new(crate_id);
|
||||
for dep in krate.dependencies(self.db)? {
|
||||
if let Some(module) = dep.krate.root_module(self.db)? {
|
||||
for dep in krate.dependencies(self.db) {
|
||||
if let Some(module) = dep.krate.root_module(self.db) {
|
||||
let def_id = module.def_id;
|
||||
self.add_module_item(
|
||||
&mut module_items,
|
||||
|
@ -93,7 +93,7 @@ impl CrateImplBlocks {
|
||||
source_root_id,
|
||||
impls: FxHashMap::default(),
|
||||
};
|
||||
if let Some(module) = krate.root_module(db)? {
|
||||
if let Some(module) = krate.root_module(db) {
|
||||
crate_impl_blocks.collect_recursive(db, module)?;
|
||||
}
|
||||
Ok(Arc::new(crate_impl_blocks))
|
||||
|
Loading…
Reference in New Issue
Block a user