range takes a ref (#20140)

This commit is contained in:
Jeff Washington (jwash)
2021-09-23 13:57:56 -05:00
committed by GitHub
parent 093dd68214
commit 254d9c8903
3 changed files with 6 additions and 6 deletions

View File

@@ -68,7 +68,7 @@ impl<T: Clone + Copy> Bucket<T> {
rv
}
pub fn items_in_range<R>(&self, range: Option<&R>) -> Vec<BucketItem<T>>
pub fn items_in_range<R>(&self, range: &Option<&R>) -> Vec<BucketItem<T>>
where
R: RangeBounds<Pubkey>,
{

View File

@@ -122,7 +122,7 @@ 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>) -> Vec<BucketItem<T>>
pub fn items_in_range<R>(&self, ix: usize, range: &Option<&R>) -> Vec<BucketItem<T>>
where
R: RangeBounds<Pubkey>,
{
@@ -435,7 +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>>),
&mut map.items_in_range(bin, &None::<&std::ops::RangeInclusive<Pubkey>>),
);
}
r