diff --git a/bucket_map/src/bucket.rs b/bucket_map/src/bucket.rs index bb646fb29..0422bf1b0 100644 --- a/bucket_map/src/bucket.rs +++ b/bucket_map/src/bucket.rs @@ -68,7 +68,7 @@ impl Bucket { rv } - pub fn items_in_range(&self, range: Option<&R>) -> Vec> + pub fn items_in_range(&self, range: &Option<&R>) -> Vec> where R: RangeBounds, { diff --git a/bucket_map/src/bucket_map.rs b/bucket_map/src/bucket_map.rs index e3039e2e6..cb7088937 100644 --- a/bucket_map/src/bucket_map.rs +++ b/bucket_map/src/bucket_map.rs @@ -122,7 +122,7 @@ impl BucketMap { } /// Get the items for bucket `ix` in `range` - pub fn items_in_range(&self, ix: usize, range: Option<&R>) -> Vec> + pub fn items_in_range(&self, ix: usize, range: &Option<&R>) -> Vec> where R: RangeBounds, { @@ -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>), + &mut map.items_in_range(bin, &None::<&std::ops::RangeInclusive>), ); } r diff --git a/runtime/src/in_mem_accounts_index.rs b/runtime/src/in_mem_accounts_index.rs index ba81daed5..3c1a14e6a 100644 --- a/runtime/src/in_mem_accounts_index.rs +++ b/runtime/src/in_mem_accounts_index.rs @@ -99,7 +99,7 @@ impl InMemAccountsIndex { Self::update_stat(&self.stats().keys, 1); // easiest implementation is to load evrything from disk into cache and return the keys self.start_stop_flush(true); - self.put_range_in_cache(None::<&RangeInclusive>); + self.put_range_in_cache(&None::<&RangeInclusive>); let keys = self.map().read().unwrap().keys().cloned().collect(); self.start_stop_flush(false); keys @@ -519,7 +519,7 @@ impl InMemAccountsIndex { if start_holding { // put everything in the cache and it will be held there - self.put_range_in_cache(Some(range)); + self.put_range_in_cache(&Some(range)); } // do this AFTER items have been put in cache - that way anyone who finds this range can know that the items are already in the cache self.just_set_hold_range_in_memory(range, start_holding); @@ -527,7 +527,7 @@ impl InMemAccountsIndex { self.start_stop_flush(false); } - fn put_range_in_cache(&self, range: Option<&R>) + fn put_range_in_cache(&self, range: &Option<&R>) where R: RangeBounds, {