Skip to content

Commit c8ebff6

Browse files
Remove some unnecessary try_map_bound
1 parent 1d12c3c commit c8ebff6

File tree

1 file changed

+2
-8
lines changed
  • compiler/rustc_trait_selection/src/traits/error_reporting

1 file changed

+2
-8
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -3185,14 +3185,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
31853185
&& let predicates = self.tcx.predicates_of(def_id).instantiate_identity(self.tcx)
31863186
&& let Some(pred) = predicates.predicates.get(*idx)
31873187
{
3188-
if let Ok(trait_pred) = pred.kind().try_map_bound(|pred| match pred {
3189-
ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => Ok(trait_pred),
3190-
_ => Err(()),
3191-
})
3192-
&& let Ok(trait_predicate) = predicate.kind().try_map_bound(|pred| match pred {
3193-
ty::PredicateKind::Clause(ty::Clause::Trait(trait_pred)) => Ok(trait_pred),
3194-
_ => Err(()),
3195-
})
3188+
if let Some(trait_pred) = pred.to_opt_poly_trait_pred()
3189+
&& let Some(trait_predicate) = predicate.to_opt_poly_trait_pred()
31963190
{
31973191
let mut c = CollectAllMismatches {
31983192
infcx: self.infcx,

0 commit comments

Comments
 (0)