1
Fork 0

Rollup merge of #111912 - WaffleLapkin:is_some_and_in_the_compiler, r=petrochenkov

Use `Option::is_some_and` and `Result::is_ok_and` in the compiler

`.is_some_and(..)`/`.is_ok_and(..)` replace `.map_or(false, ..)` and `.map(..).unwrap_or(false)`, making the code more readable.

This PR is a sibling of https://github.com/rust-lang/rust/pull/111873#issuecomment-1561316515
This commit is contained in:
Manish Goregaokar 2023-05-24 15:05:05 -07:00 committed by GitHub
commit d0b3ebee66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
97 changed files with 201 additions and 246 deletions

View file

@ -1031,7 +1031,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
});
let needs_location =
instance.map_or(false, |i| i.def.requires_caller_location(self.cx.tcx()));
instance.is_some_and(|i| i.def.requires_caller_location(self.cx.tcx()));
if needs_location {
let mir_args = if let Some(num_untupled) = num_untupled {
first_args.len() + num_untupled