Use is_some_and
/is_ok_and
in less obvious spots
This commit is contained in:
parent
84644eb9c6
commit
a3b816be53
@ -432,11 +432,9 @@ pub(crate) fn codegen_terminator_call<'tcx>(
|
|||||||
let is_cold = if fn_sig.abi() == Abi::RustCold {
|
let is_cold = if fn_sig.abi() == Abi::RustCold {
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
instance
|
instance.is_some_and(|inst| {
|
||||||
.map(|inst| {
|
fx.tcx.codegen_fn_attrs(inst.def_id()).flags.contains(CodegenFnAttrFlags::COLD)
|
||||||
fx.tcx.codegen_fn_attrs(inst.def_id()).flags.contains(CodegenFnAttrFlags::COLD)
|
})
|
||||||
})
|
|
||||||
.unwrap_or(false)
|
|
||||||
};
|
};
|
||||||
if is_cold {
|
if is_cold {
|
||||||
fx.bcx.set_cold_block(fx.bcx.current_block().unwrap());
|
fx.bcx.set_cold_block(fx.bcx.current_block().unwrap());
|
||||||
@ -470,7 +468,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Pass the caller location for `#[track_caller]`.
|
// Pass the caller location for `#[track_caller]`.
|
||||||
if instance.map(|inst| inst.def.requires_caller_location(fx.tcx)).unwrap_or(false) {
|
if instance.is_some_and(|inst| inst.def.requires_caller_location(fx.tcx)) {
|
||||||
let caller_location = fx.get_caller_location(source_info);
|
let caller_location = fx.get_caller_location(source_info);
|
||||||
args.push(CallArgument { value: caller_location, is_owned: false });
|
args.push(CallArgument { value: caller_location, is_owned: false });
|
||||||
}
|
}
|
||||||
|
@ -630,11 +630,11 @@ fn codegen_stmt<'tcx>(
|
|||||||
let to_ty = fx.monomorphize(to_ty);
|
let to_ty = fx.monomorphize(to_ty);
|
||||||
|
|
||||||
fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||||
ty.builtin_deref(true)
|
ty.builtin_deref(true).is_some_and(
|
||||||
.map(|ty::TypeAndMut { ty: pointee_ty, mutbl: _ }| {
|
|ty::TypeAndMut { ty: pointee_ty, mutbl: _ }| {
|
||||||
has_ptr_meta(fx.tcx, pointee_ty)
|
has_ptr_meta(fx.tcx, pointee_ty)
|
||||||
})
|
},
|
||||||
.unwrap_or(false)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_fat_ptr(fx, from_ty) {
|
if is_fat_ptr(fx, from_ty) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user