Skip to content

Commit 0cbee3b

Browse files
committed
Add method Impl::all_in_module(…) for supporting more localized querying
1 parent b8e83b7 commit 0cbee3b

File tree

1 file changed

+4
-0
lines changed
  • src/tools/rust-analyzer/crates/hir/src

1 file changed

+4
-0
lines changed

src/tools/rust-analyzer/crates/hir/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3724,6 +3724,10 @@ impl Impl {
37243724
inherent.all_impls().chain(trait_.all_impls()).map(Self::from).collect()
37253725
}
37263726

3727+
pub fn all_in_module(db: &dyn HirDatabase, module: Module) -> Vec<Impl> {
3728+
module.id.def_map(db.upcast())[module.id.local_id].scope.impls().map(Into::into).collect()
3729+
}
3730+
37273731
pub fn all_for_type(db: &dyn HirDatabase, Type { ty, env }: Type) -> Vec<Impl> {
37283732
let def_crates = match method_resolution::def_crates(db, &ty, env.krate) {
37293733
Some(def_crates) => def_crates,

0 commit comments

Comments
 (0)