aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-04-06 11:40:11 +0100
committerLukas Wirth <[email protected]>2021-04-06 12:58:51 +0100
commitbc993bbe85a231a7aa0414c6bea65d31d7375277 (patch)
treebe8045ab337cfc96a5bcbed691e77b6f301f9b04
parent9b4699a9be2c45ec96647c2079a32706ec65f222 (diff)
Remove TyExt::dyn_trait_ref
-rw-r--r--crates/hir_ty/src/chalk_ext.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/crates/hir_ty/src/chalk_ext.rs b/crates/hir_ty/src/chalk_ext.rs
index b101e904f..8e8a1aa48 100644
--- a/crates/hir_ty/src/chalk_ext.rs
+++ b/crates/hir_ty/src/chalk_ext.rs
@@ -29,9 +29,6 @@ pub trait TyExt {
29 29
30 fn strip_references(&self) -> &Ty; 30 fn strip_references(&self) -> &Ty;
31 31
32 /// If this is a `dyn Trait` type, this returns the `Trait` part.
33 fn dyn_trait_ref(&self) -> Option<&TraitRef>;
34
35 /// If this is a `dyn Trait`, returns that trait. 32 /// If this is a `dyn Trait`, returns that trait.
36 fn dyn_trait(&self) -> Option<TraitId>; 33 fn dyn_trait(&self) -> Option<TraitId>;
37 34
@@ -123,8 +120,8 @@ impl TyExt for Ty {
123 } 120 }
124 } 121 }
125 122
126 fn dyn_trait_ref(&self) -> Option<&TraitRef> { 123 fn dyn_trait(&self) -> Option<TraitId> {
127 match self.kind(&Interner) { 124 let trait_ref = match self.kind(&Interner) {
128 TyKind::Dyn(dyn_ty) => dyn_ty.bounds.skip_binders().interned().get(0).and_then(|b| { 125 TyKind::Dyn(dyn_ty) => dyn_ty.bounds.skip_binders().interned().get(0).and_then(|b| {
129 match b.skip_binders() { 126 match b.skip_binders() {
130 WhereClause::Implemented(trait_ref) => Some(trait_ref), 127 WhereClause::Implemented(trait_ref) => Some(trait_ref),
@@ -132,11 +129,8 @@ impl TyExt for Ty {
132 } 129 }
133 }), 130 }),
134 _ => None, 131 _ => None,
135 } 132 }?;
136 } 133 Some(from_chalk_trait_id(trait_ref.trait_id))
137
138 fn dyn_trait(&self) -> Option<TraitId> {
139 self.dyn_trait_ref().map(|it| it.trait_id).map(from_chalk_trait_id)
140 } 134 }
141 135
142 fn strip_references(&self) -> &Ty { 136 fn strip_references(&self) -> &Ty {