Skip to content

Commit f031276

Browse files
committed
Fix Clippy warning in 1.84.0
Rust 1.84.0 added a new lint "unnecessary_map_or". We use `Option::is_some_and` (introduced in Rust 1.70.0) as suggested by the lint.
1 parent 68bf1b6 commit f031276

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/plan/generational/global.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,8 @@ impl<VM: VMBinding> CommonGenPlan<VM> {
117117
// Is the GC triggered by nursery?
118118
// - if space is none, it is not. Return false immediately.
119119
// - if space is some, we further check its descriptor.
120-
let is_triggered_by_nursery = space.map_or(false, |s| {
121-
s.0.common().descriptor == self.nursery.common().descriptor
122-
});
120+
let is_triggered_by_nursery =
121+
space.is_some_and(|s| s.0.common().descriptor == self.nursery.common().descriptor);
123122
// If space is full and the GC is not triggered by nursery, next GC will be full heap GC.
124123
if space_full && !is_triggered_by_nursery {
125124
self.next_gc_full_heap.store(true, Ordering::SeqCst);
@@ -341,5 +340,5 @@ pub trait GenerationalPlanExt<VM: VMBinding>: GenerationalPlan<VM = VM> {
341340
/// with any plan (generational or not). For non generational plans, it will always return false.
342341
pub fn is_nursery_gc<VM: VMBinding>(plan: &dyn Plan<VM = VM>) -> bool {
343342
plan.generational()
344-
.map_or(false, |plan| plan.is_current_gc_nursery())
343+
.is_some_and(|plan| plan.is_current_gc_nursery())
345344
}

0 commit comments

Comments
 (0)