aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorEkaterina Babshukova <[email protected]>2019-08-16 14:34:47 +0100
committerEkaterina Babshukova <[email protected]>2019-08-16 15:07:45 +0100
commit35a04ec066b1a4ece2a6aa5e74dd8beae52e68f1 (patch)
treebafe9221a84b463233c412dfbfc43f95541b6aa2 /crates/ra_hir/src
parent2c65a059840dd2092a00e90337a8221cd832c456 (diff)
show inherent and trait impls of structs and enums
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/ty/method_resolution.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index 88d012a74..3f4c43aee 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -68,6 +68,15 @@ impl CrateImplBlocks {
68 ) 68 )
69 } 69 }
70 70
71 pub fn all_impls<'a>(&'a self) -> impl Iterator<Item = ImplBlock> + 'a {
72 self.impls.values().chain(self.impls_by_trait.values()).flat_map(|i| i.iter()).map(
73 move |(module_id, impl_id)| {
74 let module = Module { krate: self.krate, module_id: *module_id };
75 ImplBlock::from_id(module, *impl_id)
76 },
77 )
78 }
79
71 fn collect_recursive(&mut self, db: &impl HirDatabase, module: Module) { 80 fn collect_recursive(&mut self, db: &impl HirDatabase, module: Module) {
72 let module_impl_blocks = db.impls_in_module(module); 81 let module_impl_blocks = db.impls_in_module(module);
73 82