diff options
| author | Michael Goulet <michael@errs.io> | 2022-12-21 05:07:50 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-12-21 06:06:46 +0000 |
| commit | c8ebff6aeea5bc9242269e5f072442db62be734b (patch) | |
| tree | 7e54cc805bdf179bfe8a79860e150bcb3f74cb30 | |
| parent | 1d12c3cea30b8ba4a09650a9e9c46fe9fbe25f0b (diff) | |
| download | rust-c8ebff6aeea5bc9242269e5f072442db62be734b.tar.gz rust-c8ebff6aeea5bc9242269e5f072442db62be734b.zip | |
Remove some unnecessary try_map_bound
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 036e8f6d47b..60f67491364 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -3185,14 +3185,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { && let predicates = self.tcx.predicates_of(def_id).instantiate_identity(self.tcx) && let Some(pred) = predicates.predicates.get(*idx) { - if let Ok(trait_pred) = pred.kind().try_map_bound(|pred| match pred { - ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => Ok(trait_pred), - _ => Err(()), - }) - && let Ok(trait_predicate) = predicate.kind().try_map_bound(|pred| match pred { - ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => Ok(trait_pred), - _ => Err(()), - }) + if let Some(trait_pred) = pred.to_opt_poly_trait_pred() + && let Some(trait_predicate) = predicate.to_opt_poly_trait_pred() { let mut c = CollectAllMismatches { infcx: self.infcx, |
