Use is_some_and
/is_ok_and
in less obvious spots
This commit is contained in:
parent
fb0f74a8c9
commit
307799a711
19 changed files with 53 additions and 88 deletions
|
@ -224,12 +224,9 @@ impl<'tcx> BorrowExplanation<'tcx> {
|
|||
if info.tail_result_is_ignored {
|
||||
// #85581: If the first mutable borrow's scope contains
|
||||
// the second borrow, this suggestion isn't helpful.
|
||||
if !multiple_borrow_span
|
||||
.map(|(old, new)| {
|
||||
old.to(info.span.shrink_to_hi()).contains(new)
|
||||
})
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if !multiple_borrow_span.is_some_and(|(old, new)| {
|
||||
old.to(info.span.shrink_to_hi()).contains(new)
|
||||
}) {
|
||||
err.span_suggestion_verbose(
|
||||
info.span.shrink_to_hi(),
|
||||
"consider adding semicolon after the expression so its \
|
||||
|
|
|
@ -289,8 +289,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||
.body
|
||||
.local_decls
|
||||
.get(local)
|
||||
.map(|l| mut_borrow_of_mutable_ref(l, self.local_names[local]))
|
||||
.unwrap_or(false) =>
|
||||
.is_some_and(|l| mut_borrow_of_mutable_ref(l, self.local_names[local])) =>
|
||||
{
|
||||
let decl = &self.body.local_decls[local];
|
||||
err.span_label(span, format!("cannot {act}"));
|
||||
|
|
|
@ -125,8 +125,7 @@ impl OutlivesSuggestionBuilder {
|
|||
|(r, _)| {
|
||||
self.constraints_to_add
|
||||
.get(r)
|
||||
.map(|r_outlived| r_outlived.as_slice().contains(fr))
|
||||
.unwrap_or(false)
|
||||
.is_some_and(|r_outlived| r_outlived.as_slice().contains(fr))
|
||||
},
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue