diff --git a/src/bitmap/mod.rs b/src/bitmap/mod.rs index 1dd391b..f8eb040 100644 --- a/src/bitmap/mod.rs +++ b/src/bitmap/mod.rs @@ -2689,8 +2689,7 @@ pub(crate) mod tests { fn infinite_intersects_finite(infinite: &RangeFrom, finite: &Bitmap) -> bool { finite - .last_set() - .map_or(false, |last_set| infinite.start <= last_set) + .last_set().is_some_and(|last_set| infinite.start <= last_set) } prop_assert_eq!( bitmap.intersects(&other), diff --git a/src/ffi/int.rs b/src/ffi/int.rs index 32c083a..77827ae 100644 --- a/src/ffi/int.rs +++ b/src/ffi/int.rs @@ -64,7 +64,7 @@ pub(crate) fn expect_usize(x: c_uint) -> usize { pub(crate) fn assert_slice_len(len: usize) { assert!( len.checked_mul(std::mem::size_of::()) - .map_or(false, |prod| isize::try_from(prod).is_ok()), + .is_some_and(|prod| isize::try_from(prod).is_ok()), "got an unsupported slice length from hwloc" ) } diff --git a/src/object/depth.rs b/src/object/depth.rs index c8ed553..4a43886 100644 --- a/src/object/depth.rs +++ b/src/object/depth.rs @@ -203,7 +203,7 @@ impl PartialEq for NormalDepth { // impl PartialEq for Depth { fn eq(&self, other: &usize) -> bool { - Self::try_from(*other).map_or(false, |other| *self == other) + Self::try_from(*other) == Ok(*self) } } // @@ -411,7 +411,7 @@ mod tests { fn eq_usize(depth: Depth, value: usize) { prop_assert_eq!( depth == value, - PositiveInt::try_from(value).map_or(false, |value| depth == value) + PositiveInt::try_from(value).is_ok_and(|value| depth == value) ); } } diff --git a/src/object/mod.rs b/src/object/mod.rs index 29a51aa..6b1153d 100644 --- a/src/object/mod.rs +++ b/src/object/mod.rs @@ -440,11 +440,7 @@ impl TopologyObject { pub fn first_shared_cache(&self) -> Option<&Self> { let cpuset = self.cpuset()?; self.ancestors() - .skip_while(|ancestor| { - ancestor - .cpuset() - .map_or(false, |ancestor_set| ancestor_set == cpuset) - }) + .skip_while(|ancestor| ancestor.cpuset() == Some(cpuset)) .find(|ancestor| ancestor.object_type().is_cpu_data_cache()) } diff --git a/src/topology/mod.rs b/src/topology/mod.rs index 50ffc64..2679cd5 100644 --- a/src/topology/mod.rs +++ b/src/topology/mod.rs @@ -343,7 +343,7 @@ impl Topology { get_group: fn(&FeatureSupport) -> Option<&Group>, check_feature: fn(&Group) -> bool, ) -> bool { - get_group(self.feature_support()).map_or(false, check_feature) + get_group(self.feature_support()).is_some_and(check_feature) } /// Filtering that was applied for the given object type