Small improvements from review comments
This commit is contained in:
parent
d0bdaa6c00
commit
5db5f5cc1d
@ -104,7 +104,7 @@ pub trait HirDatabase: SyntaxDatabase
|
||||
|
||||
fn impls_in_crate(krate: Crate) -> Cancelable<Arc<CrateImplBlocks>> {
|
||||
type ImplsInCrateQuery;
|
||||
use fn crate::ty::method_resolution::impls_in_crate;
|
||||
use fn crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query;
|
||||
}
|
||||
|
||||
fn body_hir(def_id: DefId) -> Cancelable<Arc<crate::expr::Body>> {
|
||||
|
@ -170,10 +170,10 @@ impl ModuleImplBlocks {
|
||||
let (file_id, module_source) = module.definition_source(db)?;
|
||||
let node = match &module_source {
|
||||
ModuleSource::SourceFile(node) => node.syntax(),
|
||||
ModuleSource::Module(node) => match node.item_list() {
|
||||
Some(item_list) => item_list.syntax(),
|
||||
None => return Ok(()),
|
||||
},
|
||||
ModuleSource::Module(node) => node
|
||||
.item_list()
|
||||
.expect("inline module should have item list")
|
||||
.syntax(),
|
||||
};
|
||||
|
||||
let source_file_items = db.file_items(file_id.into());
|
||||
|
@ -81,23 +81,23 @@ impl CrateImplBlocks {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn impls_in_crate(
|
||||
db: &impl HirDatabase,
|
||||
krate: Crate,
|
||||
) -> Cancelable<Arc<CrateImplBlocks>> {
|
||||
let crate_graph = db.crate_graph();
|
||||
let file_id = crate_graph.crate_root(krate.crate_id);
|
||||
let source_root_id = db.file_source_root(file_id);
|
||||
let mut crate_impl_blocks = CrateImplBlocks {
|
||||
source_root_id,
|
||||
impls: FxHashMap::default(),
|
||||
};
|
||||
if let Some(module) = krate.root_module(db)? {
|
||||
crate_impl_blocks.collect_recursive(db, module)?;
|
||||
pub(crate) fn impls_in_crate_query(
|
||||
db: &impl HirDatabase,
|
||||
krate: Crate,
|
||||
) -> Cancelable<Arc<CrateImplBlocks>> {
|
||||
let crate_graph = db.crate_graph();
|
||||
let file_id = crate_graph.crate_root(krate.crate_id);
|
||||
let source_root_id = db.file_source_root(file_id);
|
||||
let mut crate_impl_blocks = CrateImplBlocks {
|
||||
source_root_id,
|
||||
impls: FxHashMap::default(),
|
||||
};
|
||||
if let Some(module) = krate.root_module(db)? {
|
||||
crate_impl_blocks.collect_recursive(db, module)?;
|
||||
}
|
||||
Ok(Arc::new(crate_impl_blocks))
|
||||
}
|
||||
Ok(Arc::new(crate_impl_blocks))
|
||||
}
|
||||
|
||||
fn def_crate(db: &impl HirDatabase, ty: &Ty) -> Cancelable<Option<Crate>> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user