@@ -68,7 +68,7 @@ use hir_ty::{
68
68
all_super_traits, autoderef, check_orphan_rules,
69
69
consteval:: { try_const_usize, unknown_const_as_generic, ConstExt } ,
70
70
diagnostics:: BodyValidationDiagnostic ,
71
- error_lifetime, known_const_to_ast,
71
+ direct_super_traits , error_lifetime, known_const_to_ast,
72
72
layout:: { Layout as TyLayout , RustcEnumVariantIdx , RustcFieldIdx , TagEncoding } ,
73
73
method_resolution,
74
74
mir:: { interpret_mir, MutBorrowKind } ,
@@ -2704,6 +2704,11 @@ impl Trait {
2704
2704
db. trait_data ( self . id ) . name . clone ( )
2705
2705
}
2706
2706
2707
+ pub fn direct_supertraits ( self , db : & dyn HirDatabase ) -> Vec < Trait > {
2708
+ let traits = direct_super_traits ( db. upcast ( ) , self . into ( ) ) ;
2709
+ traits. iter ( ) . map ( |tr| Trait :: from ( * tr) ) . collect ( )
2710
+ }
2711
+
2707
2712
pub fn all_supertraits ( self , db : & dyn HirDatabase ) -> Vec < Trait > {
2708
2713
let traits = all_super_traits ( db. upcast ( ) , self . into ( ) ) ;
2709
2714
traits. iter ( ) . map ( |tr| Trait :: from ( * tr) ) . collect ( )
0 commit comments