diff options
Diffstat (limited to 'compiler/rustc_trait_selection')
5 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index 644bfd33970..f722f281314 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -358,7 +358,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { // Can only unsize to an object-safe type if data .principal_def_id() - .map_or(false, |def_id| !tcx.check_is_object_safe(def_id)) + .is_some_and(|def_id| !tcx.check_is_object_safe(def_id)) { return Err(NoSolution); } diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 969e5fa64b0..aacbfbd3c87 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -706,7 +706,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OrphanChecker<'tcx> { } ty::Dynamic(tt, ..) => { let principal = tt.principal().map(|p| p.def_id()); - if principal.map_or(false, |p| self.def_id_is_local(p)) { + if principal.is_some_and(|p| self.def_id_is_local(p)) { ControlFlow::Break(OrphanCheckEarlyExit::LocalTy(ty)) } else { self.found_non_local_ty(ty) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index dc43a3d154a..a10ececbb1e 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -437,7 +437,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // 1) strictly implied by another error. // 2) implied by an error with a smaller index. for error2 in error_set { - if error2.index.map_or(false, |index2| is_suppressed[index2]) { + if error2.index.is_some_and(|index2| is_suppressed[index2]) { // Avoid errors being suppressed by already-suppressed // errors, to prevent all errors from being suppressed // at once. 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 83511e898f7..82bad96ea42 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -420,7 +420,7 @@ fn suggest_restriction<'tcx>( ) { if hir_generics.where_clause_span.from_expansion() || hir_generics.where_clause_span.desugaring_kind().is_some() - || projection.map_or(false, |projection| tcx.opt_rpitit_info(projection.def_id).is_some()) + || projection.is_some_and(|projection| tcx.opt_rpitit_info(projection.def_id).is_some()) { return; } @@ -2936,7 +2936,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { "note_obligation_cause_code: check for async fn" ); if is_future - && obligated_types.last().map_or(false, |ty| match ty.kind() { + && obligated_types.last().is_some_and(|ty| match ty.kind() { ty::Generator(last_def_id, ..) => { tcx.generator_is_async(*last_def_id) } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index b366bbd531b..3baf1c97c9f 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -1793,12 +1793,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { .infcx .at(&obligation.cause, obligation.param_env) .sup(DefineOpaqueTypes::No, obligation.predicate, infer_projection) - .map_or(false, |InferOk { obligations, value: () }| { + .is_ok_and(|InferOk { obligations, value: () }| { self.evaluate_predicates_recursively( TraitObligationStackList::empty(&ProvisionalEvaluationCache::default()), nested_obligations.into_iter().chain(obligations), ) - .map_or(false, |res| res.may_apply()) + .is_ok_and(|res| res.may_apply()) }); if is_match { |
