mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Add direct_supertraits(…)
HIR-level method to hir::Trait
type
This commit is contained in:
parent
c1155213f3
commit
e6461522bc
1 changed files with 6 additions and 1 deletions
|
@ -68,7 +68,7 @@ use hir_ty::{
|
|||
all_super_traits, autoderef, check_orphan_rules,
|
||||
consteval::{try_const_usize, unknown_const_as_generic, ConstExt},
|
||||
diagnostics::BodyValidationDiagnostic,
|
||||
error_lifetime, known_const_to_ast,
|
||||
direct_super_traits, error_lifetime, known_const_to_ast,
|
||||
layout::{Layout as TyLayout, RustcEnumVariantIdx, RustcFieldIdx, TagEncoding},
|
||||
method_resolution,
|
||||
mir::{interpret_mir, MutBorrowKind},
|
||||
|
@ -2704,6 +2704,11 @@ impl Trait {
|
|||
db.trait_data(self.id).name.clone()
|
||||
}
|
||||
|
||||
pub fn direct_supertraits(self, db: &dyn HirDatabase) -> Vec<Trait> {
|
||||
let traits = direct_super_traits(db.upcast(), self.into());
|
||||
traits.iter().map(|tr| Trait::from(*tr)).collect()
|
||||
}
|
||||
|
||||
pub fn all_supertraits(self, db: &dyn HirDatabase) -> Vec<Trait> {
|
||||
let traits = all_super_traits(db.upcast(), self.into());
|
||||
traits.iter().map(|tr| Trait::from(*tr)).collect()
|
||||
|
|
Loading…
Reference in a new issue