Skip to content

Commit ba73a53

Browse files
author
Gianmarco Garrisi
committed
Undo clippy lint use is_none_or instead of map_or(true, ...)
1 parent f9342b4 commit ba73a53

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/double_priority_queue/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ where
612612
///
613613
/// Computes in **O(log(N))** time.
614614
pub fn push_increase(&mut self, item: I, priority: P) -> Option<P> {
615-
if self.get_priority(&item).is_none_or(|p| priority > *p) {
615+
if self.get_priority(&item).map_or(true, |p| priority > *p) {
616616
self.push(item, priority)
617617
} else {
618618
Some(priority)
@@ -650,7 +650,7 @@ where
650650
///
651651
/// Computes in **O(log(N))** time.
652652
pub fn push_decrease(&mut self, item: I, priority: P) -> Option<P> {
653-
if self.get_priority(&item).is_none_or(|p| priority < *p) {
653+
if self.get_priority(&item).map_or(true, |p| priority < *p) {
654654
self.push(item, priority)
655655
} else {
656656
Some(priority)

src/priority_queue/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ where
486486
///
487487
/// Computes in **O(log(N))** time.
488488
pub fn push_increase(&mut self, item: I, priority: P) -> Option<P> {
489-
if self.get_priority(&item).is_none_or(|p| priority > *p) {
489+
if self.get_priority(&item).map_or(true, |p| priority > *p) {
490490
self.push(item, priority)
491491
} else {
492492
Some(priority)
@@ -524,7 +524,7 @@ where
524524
///
525525
/// Computes in **O(log(N))** time.
526526
pub fn push_decrease(&mut self, item: I, priority: P) -> Option<P> {
527-
if self.get_priority(&item).is_none_or(|p| priority < *p) {
527+
if self.get_priority(&item).map_or(true, |p| priority < *p) {
528528
self.push(item, priority)
529529
} else {
530530
Some(priority)

src/store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ where
330330
self.map.retain2(predicate);
331331
if self.map.len() != self.size {
332332
self.size = self.map.len();
333-
self.heap = (0..self.size).into_iter().map(|i| Index(i)).collect();
334-
self.qp = (0..self.size).into_iter().map(|p| Position(p)).collect();
333+
self.heap = (0..self.size).map(Index).collect();
334+
self.qp = (0..self.size).map(Position).collect();
335335
}
336336
}
337337

0 commit comments

Comments
 (0)