diff --git a/bucket_map/src/bucket_map.rs b/bucket_map/src/bucket_map.rs index 7699f2faf8..e3039e2e6f 100644 --- a/bucket_map/src/bucket_map.rs +++ b/bucket_map/src/bucket_map.rs @@ -122,17 +122,16 @@ impl BucketMap { } /// Get the items for bucket `ix` in `range` - pub fn items_in_range(&self, ix: usize, range: Option<&R>) -> Option>> + pub fn items_in_range(&self, ix: usize, range: Option<&R>) -> Vec> where R: RangeBounds, { - Some( - self.buckets[ix] - .read() - .unwrap() - .as_ref()? - .items_in_range(range), - ) + self.buckets[ix] + .read() + .unwrap() + .as_ref() + .map(|bucket| bucket.items_in_range(range)) + .unwrap_or_default() } /// Get the Pubkeys for bucket `ix` @@ -436,9 +435,7 @@ mod tests { let mut r = vec![]; for bin in 0..map.num_buckets() { r.append( - &mut map - .items_in_range(bin, None::<&std::ops::RangeInclusive>) - .unwrap_or_default(), + &mut map.items_in_range(bin, None::<&std::ops::RangeInclusive>), ); } r