We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
direct_supertraits(…)
hir::Trait
1 parent c115521 commit e646152Copy full SHA for e646152
crates/hir/src/lib.rs
@@ -68,7 +68,7 @@ use hir_ty::{
68
all_super_traits, autoderef, check_orphan_rules,
69
consteval::{try_const_usize, unknown_const_as_generic, ConstExt},
70
diagnostics::BodyValidationDiagnostic,
71
- error_lifetime, known_const_to_ast,
+ direct_super_traits, error_lifetime, known_const_to_ast,
72
layout::{Layout as TyLayout, RustcEnumVariantIdx, RustcFieldIdx, TagEncoding},
73
method_resolution,
74
mir::{interpret_mir, MutBorrowKind},
@@ -2704,6 +2704,11 @@ impl Trait {
2704
db.trait_data(self.id).name.clone()
2705
}
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
+
2712
pub fn all_supertraits(self, db: &dyn HirDatabase) -> Vec<Trait> {
2713
let traits = all_super_traits(db.upcast(), self.into());
2714
traits.iter().map(|tr| Trait::from(*tr)).collect()
0 commit comments