bucketmap items_in_range does not return Option (#20036)
This commit is contained in:
parent
6926d59d39
commit
4716cd518d
|
@ -122,17 +122,16 @@ impl<T: Clone + Copy + Debug> BucketMap<T> {
|
|||
}
|
||||
|
||||
/// Get the items for bucket `ix` in `range`
|
||||
pub fn items_in_range<R>(&self, ix: usize, range: Option<&R>) -> Option<Vec<BucketItem<T>>>
|
||||
pub fn items_in_range<R>(&self, ix: usize, range: Option<&R>) -> Vec<BucketItem<T>>
|
||||
where
|
||||
R: RangeBounds<Pubkey>,
|
||||
{
|
||||
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<Pubkey>>)
|
||||
.unwrap_or_default(),
|
||||
&mut map.items_in_range(bin, None::<&std::ops::RangeInclusive<Pubkey>>),
|
||||
);
|
||||
}
|
||||
r
|
||||
|
|
Loading…
Reference in New Issue