File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -3701,6 +3701,24 @@ impl Impl {
3701
3701
inherent. all_impls ( ) . chain ( trait_. all_impls ( ) ) . map ( Self :: from) . collect ( )
3702
3702
}
3703
3703
3704
+ pub fn all_in_module ( db : & dyn HirDatabase , module : Module ) -> Vec < Impl > {
3705
+ if let Some ( block_id) = module. id . containing_block ( ) {
3706
+ let mut impls = vec ! [ ] ;
3707
+
3708
+ if let Some ( inherent_impls) = db. inherent_impls_in_block ( block_id) {
3709
+ impls. extend ( inherent_impls. all_impls ( ) . into_iter ( ) . map ( Self :: from) ) ;
3710
+ }
3711
+
3712
+ if let Some ( trait_impls) = db. trait_impls_in_block ( block_id) {
3713
+ impls. extend ( trait_impls. all_impls ( ) . into_iter ( ) . map ( Self :: from) ) ;
3714
+ }
3715
+
3716
+ impls
3717
+ } else {
3718
+ Self :: all_in_crate ( db, module. krate ( ) )
3719
+ }
3720
+ }
3721
+
3704
3722
pub fn all_for_type ( db : & dyn HirDatabase , Type { ty, env } : Type ) -> Vec < Impl > {
3705
3723
let def_crates = match method_resolution:: def_crates ( db, & ty, env. krate ) {
3706
3724
Some ( def_crates) => def_crates,
You can’t perform that action at this time.
0 commit comments