Skip to content

Commit bc993bb

Browse files
committed
Remove TyExt::dyn_trait_ref
1 parent 9b4699a commit bc993bb

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

crates/hir_ty/src/chalk_ext.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ pub trait TyExt {
2929

3030
fn strip_references(&self) -> &Ty;
3131

32-
/// If this is a `dyn Trait` type, this returns the `Trait` part.
33-
fn dyn_trait_ref(&self) -> Option<&TraitRef>;
34-
3532
/// If this is a `dyn Trait`, returns that trait.
3633
fn dyn_trait(&self) -> Option<TraitId>;
3734

@@ -123,20 +120,17 @@ impl TyExt for Ty {
123120
}
124121
}
125122

126-
fn dyn_trait_ref(&self) -> Option<&TraitRef> {
127-
match self.kind(&Interner) {
123+
fn dyn_trait(&self) -> Option<TraitId> {
124+
let trait_ref = match self.kind(&Interner) {
128125
TyKind::Dyn(dyn_ty) => dyn_ty.bounds.skip_binders().interned().get(0).and_then(|b| {
129126
match b.skip_binders() {
130127
WhereClause::Implemented(trait_ref) => Some(trait_ref),
131128
_ => None,
132129
}
133130
}),
134131
_ => None,
135-
}
136-
}
137-
138-
fn dyn_trait(&self) -> Option<TraitId> {
139-
self.dyn_trait_ref().map(|it| it.trait_id).map(from_chalk_trait_id)
132+
}?;
133+
Some(from_chalk_trait_id(trait_ref.trait_id))
140134
}
141135

142136
fn strip_references(&self) -> &Ty {

0 commit comments

Comments
 (0)