mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Remove TyExt::dyn_trait_ref
This commit is contained in:
parent
9b4699a9be
commit
bc993bbe85
1 changed files with 4 additions and 10 deletions
|
@ -29,9 +29,6 @@ pub trait TyExt {
|
||||||
|
|
||||||
fn strip_references(&self) -> &Ty;
|
fn strip_references(&self) -> &Ty;
|
||||||
|
|
||||||
/// If this is a `dyn Trait` type, this returns the `Trait` part.
|
|
||||||
fn dyn_trait_ref(&self) -> Option<&TraitRef>;
|
|
||||||
|
|
||||||
/// If this is a `dyn Trait`, returns that trait.
|
/// If this is a `dyn Trait`, returns that trait.
|
||||||
fn dyn_trait(&self) -> Option<TraitId>;
|
fn dyn_trait(&self) -> Option<TraitId>;
|
||||||
|
|
||||||
|
@ -123,8 +120,8 @@ impl TyExt for Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dyn_trait_ref(&self) -> Option<&TraitRef> {
|
fn dyn_trait(&self) -> Option<TraitId> {
|
||||||
match self.kind(&Interner) {
|
let trait_ref = match self.kind(&Interner) {
|
||||||
TyKind::Dyn(dyn_ty) => dyn_ty.bounds.skip_binders().interned().get(0).and_then(|b| {
|
TyKind::Dyn(dyn_ty) => dyn_ty.bounds.skip_binders().interned().get(0).and_then(|b| {
|
||||||
match b.skip_binders() {
|
match b.skip_binders() {
|
||||||
WhereClause::Implemented(trait_ref) => Some(trait_ref),
|
WhereClause::Implemented(trait_ref) => Some(trait_ref),
|
||||||
|
@ -132,11 +129,8 @@ impl TyExt for Ty {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}?;
|
||||||
}
|
Some(from_chalk_trait_id(trait_ref.trait_id))
|
||||||
|
|
||||||
fn dyn_trait(&self) -> Option<TraitId> {
|
|
||||||
self.dyn_trait_ref().map(|it| it.trait_id).map(from_chalk_trait_id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn strip_references(&self) -> &Ty {
|
fn strip_references(&self) -> &Ty {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue