From 275adf90075a8dc9cc4266646966b0f0209fafcf Mon Sep 17 00:00:00 2001 From: ripytide Date: Fri, 31 Mar 2023 17:39:31 +0100 Subject: [PATCH] no need for len() == 0 in an is_empty() wrapper --- src/range_bounds_map.rs | 12 ++++++------ src/range_bounds_set.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/range_bounds_map.rs b/src/range_bounds_map.rs index 80053f8..a927f5f 100644 --- a/src/range_bounds_map.rs +++ b/src/range_bounds_map.rs @@ -327,7 +327,7 @@ where /// ``` #[trivial] pub fn is_empty(&self) -> bool { - self.len() == 0 + self.starts.is_empty() } /// Adds a new (`RangeBounds`, `Value`) pair to the map without @@ -337,10 +337,12 @@ where /// already in the map rather than just touching, then an /// [`OverlapError`] is returned and the map is not updated. /// - /// # Panics + /// # Panics /// - /// Panics if the given `range_bounds` is an invalid - /// `RangeBounds`. See [`Invalid RangeBounds`] for more details. + /// Panics if the given `range_bounds` is an invalid + /// `RangeBounds`. See [`Invalid + /// RangeBounds`](https://docs.rs/range_bounds_map/latest/range_bounds_map/index.html#Invalid-RangeBounds) + /// for more details. /// /// # Examples /// ``` @@ -354,8 +356,6 @@ where /// Err(OverlapError) /// ); /// assert_eq!(range_bounds_map.len(), 1); - /// - /// [`Invalid RangeBounds`]: https://docs.rs/range_bounds_map/latest/range_bounds_map/index.html#Invalid-RangeBounds /// ``` #[tested] pub fn insert_strict( diff --git a/src/range_bounds_set.rs b/src/range_bounds_set.rs index f549571..7121bfb 100644 --- a/src/range_bounds_set.rs +++ b/src/range_bounds_set.rs @@ -171,7 +171,7 @@ where /// ``` #[trivial] pub fn is_empty(&self) -> bool { - self.len() == 0 + self.map.is_empty() } /// Adds a new `RangeBounds` to the set without modifying other