diff options
Diffstat (limited to 'crates/ra_hir_ty/src/lib.rs')
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index ccc4348f4..daea02f88 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs | |||
@@ -808,15 +808,13 @@ impl Ty { | |||
808 | } | 808 | } |
809 | } | 809 | } |
810 | 810 | ||
811 | /// If this is an `impl Trait` or `dyn Trait`, returns that trait. | 811 | /// If this is a `dyn Trait`, returns that trait. |
812 | pub fn inherent_trait(&self) -> Option<TraitId> { | 812 | pub fn dyn_trait(&self) -> Option<TraitId> { |
813 | match self { | 813 | match self { |
814 | Ty::Dyn(predicates) | Ty::Opaque(predicates) => { | 814 | Ty::Dyn(predicates) => predicates.iter().find_map(|pred| match pred { |
815 | predicates.iter().find_map(|pred| match pred { | 815 | GenericPredicate::Implemented(tr) => Some(tr.trait_), |
816 | GenericPredicate::Implemented(tr) => Some(tr.trait_), | 816 | _ => None, |
817 | _ => None, | 817 | }), |
818 | }) | ||
819 | } | ||
820 | _ => None, | 818 | _ => None, |
821 | } | 819 | } |
822 | } | 820 | } |