Skip to content

Commit a3b816b

Browse files
committed
Use is_some_and/is_ok_and in less obvious spots
1 parent 84644eb commit a3b816b

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/abi/mod.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,9 @@ pub(crate) fn codegen_terminator_call<'tcx>(
432432
let is_cold = if fn_sig.abi() == Abi::RustCold {
433433
true
434434
} else {
435-
instance
436-
.map(|inst| {
437-
fx.tcx.codegen_fn_attrs(inst.def_id()).flags.contains(CodegenFnAttrFlags::COLD)
438-
})
439-
.unwrap_or(false)
435+
instance.is_some_and(|inst| {
436+
fx.tcx.codegen_fn_attrs(inst.def_id()).flags.contains(CodegenFnAttrFlags::COLD)
437+
})
440438
};
441439
if is_cold {
442440
fx.bcx.set_cold_block(fx.bcx.current_block().unwrap());
@@ -470,7 +468,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
470468
};
471469

472470
// Pass the caller location for `#[track_caller]`.
473-
if instance.map(|inst| inst.def.requires_caller_location(fx.tcx)).unwrap_or(false) {
471+
if instance.is_some_and(|inst| inst.def.requires_caller_location(fx.tcx)) {
474472
let caller_location = fx.get_caller_location(source_info);
475473
args.push(CallArgument { value: caller_location, is_owned: false });
476474
}

src/base.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,11 @@ fn codegen_stmt<'tcx>(
630630
let to_ty = fx.monomorphize(to_ty);
631631

632632
fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
633-
ty.builtin_deref(true)
634-
.map(|ty::TypeAndMut { ty: pointee_ty, mutbl: _ }| {
633+
ty.builtin_deref(true).is_some_and(
634+
|ty::TypeAndMut { ty: pointee_ty, mutbl: _ }| {
635635
has_ptr_meta(fx.tcx, pointee_ty)
636-
})
637-
.unwrap_or(false)
636+
},
637+
)
638638
}
639639

640640
if is_fat_ptr(fx, from_ty) {

0 commit comments

Comments
 (0)