From 35a04ec066b1a4ece2a6aa5e74dd8beae52e68f1 Mon Sep 17 00:00:00 2001 From: Ekaterina Babshukova Date: Fri, 16 Aug 2019 16:34:47 +0300 Subject: show inherent and trait impls of structs and enums --- crates/ra_hir/src/ty/method_resolution.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/ra_hir/src') 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 { ) } + pub fn all_impls<'a>(&'a self) -> impl Iterator + 'a { + self.impls.values().chain(self.impls_by_trait.values()).flat_map(|i| i.iter()).map( + move |(module_id, impl_id)| { + let module = Module { krate: self.krate, module_id: *module_id }; + ImplBlock::from_id(module, *impl_id) + }, + ) + } + fn collect_recursive(&mut self, db: &impl HirDatabase, module: Module) { let module_impl_blocks = db.impls_in_module(module); -- cgit v1.2.3