aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-01-12 20:51:56 +0000
committerFlorian Diebold <[email protected]>2019-01-12 20:51:56 +0000
commit5db5f5cc1dc5dfbded866b59570afc50538b9091 (patch)
treec03c3d5224eeb9c9a4c99e78851e209f5ffe2cd6 /crates/ra_hir
parentd0bdaa6c00faa503db58f2a7987d1252086b4441 (diff)
Small improvements from review comments
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/db.rs2
-rw-r--r--crates/ra_hir/src/impl_block.rs8
-rw-r--r--crates/ra_hir/src/ty/method_resolution.rs30
3 files changed, 20 insertions, 20 deletions
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 842f54f11..fd6336dd8 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -104,7 +104,7 @@ pub trait HirDatabase: SyntaxDatabase
104 104
105 fn impls_in_crate(krate: Crate) -> Cancelable<Arc<CrateImplBlocks>> { 105 fn impls_in_crate(krate: Crate) -> Cancelable<Arc<CrateImplBlocks>> {
106 type ImplsInCrateQuery; 106 type ImplsInCrateQuery;
107 use fn crate::ty::method_resolution::impls_in_crate; 107 use fn crate::ty::method_resolution::CrateImplBlocks::impls_in_crate_query;
108 } 108 }
109 109
110 fn body_hir(def_id: DefId) -> Cancelable<Arc<crate::expr::Body>> { 110 fn body_hir(def_id: DefId) -> Cancelable<Arc<crate::expr::Body>> {
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 23c1d98d5..d0b086308 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -170,10 +170,10 @@ impl ModuleImplBlocks {
170 let (file_id, module_source) = module.definition_source(db)?; 170 let (file_id, module_source) = module.definition_source(db)?;
171 let node = match &module_source { 171 let node = match &module_source {
172 ModuleSource::SourceFile(node) => node.syntax(), 172 ModuleSource::SourceFile(node) => node.syntax(),
173 ModuleSource::Module(node) => match node.item_list() { 173 ModuleSource::Module(node) => node
174 Some(item_list) => item_list.syntax(), 174 .item_list()
175 None => return Ok(()), 175 .expect("inline module should have item list")
176 }, 176 .syntax(),
177 }; 177 };
178 178
179 let source_file_items = db.file_items(file_id.into()); 179 let source_file_items = db.file_items(file_id.into());
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index ad80aa8b6..1330d03a8 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -81,23 +81,23 @@ impl CrateImplBlocks {
81 81
82 Ok(()) 82 Ok(())
83 } 83 }
84}
85 84
86pub(crate) fn impls_in_crate( 85 pub(crate) fn impls_in_crate_query(
87 db: &impl HirDatabase, 86 db: &impl HirDatabase,
88 krate: Crate, 87 krate: Crate,
89) -> Cancelable<Arc<CrateImplBlocks>> { 88 ) -> Cancelable<Arc<CrateImplBlocks>> {
90 let crate_graph = db.crate_graph(); 89 let crate_graph = db.crate_graph();
91 let file_id = crate_graph.crate_root(krate.crate_id); 90 let file_id = crate_graph.crate_root(krate.crate_id);
92 let source_root_id = db.file_source_root(file_id); 91 let source_root_id = db.file_source_root(file_id);
93 let mut crate_impl_blocks = CrateImplBlocks { 92 let mut crate_impl_blocks = CrateImplBlocks {
94 source_root_id, 93 source_root_id,
95 impls: FxHashMap::default(), 94 impls: FxHashMap::default(),
96 }; 95 };
97 if let Some(module) = krate.root_module(db)? { 96 if let Some(module) = krate.root_module(db)? {
98 crate_impl_blocks.collect_recursive(db, module)?; 97 crate_impl_blocks.collect_recursive(db, module)?;
98 }
99 Ok(Arc::new(crate_impl_blocks))
99 } 100 }
100 Ok(Arc::new(crate_impl_blocks))
101} 101}
102 102
103fn def_crate(db: &impl HirDatabase, ty: &Ty) -> Cancelable<Option<Crate>> { 103fn def_crate(db: &impl HirDatabase, ty: &Ty) -> Cancelable<Option<Crate>> {