From b538ff8b277b69d9ef1796b322f6c435a4d097ac Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Wed, 15 Sep 2021 15:35:20 -0500 Subject: [PATCH] use Arc::clone() instead --- bucket_map/src/bucket.rs | 12 ++++++------ bucket_map/src/bucket_map.rs | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bucket_map/src/bucket.rs b/bucket_map/src/bucket.rs index 78472cd08f..5cddff8be9 100644 --- a/bucket_map/src/bucket.rs +++ b/bucket_map/src/bucket.rs @@ -33,11 +33,11 @@ impl Bucket { stats: Arc, ) -> Self { let index = DataBucket::new( - drives.clone(), + Arc::clone(&drives), 1, std::mem::size_of::() as u64, max_search, - stats.index.clone(), + Arc::clone(&stats.index), ); Self { random: thread_rng().gen(), @@ -296,12 +296,12 @@ impl Bucket { //likelyhood of a re-index collision of 2^(max_search)^2 //1 in 2^32 let index = DataBucket::new_with_capacity( - self.drives.clone(), + Arc::clone(&self.drives), 1, std::mem::size_of::() as u64, self.index.capacity + i, // * 2, self.index.max_search, - self.stats.index.clone(), + Arc::clone(&self.stats.index), ); let random = thread_rng().gen(); let mut valid = true; @@ -352,11 +352,11 @@ impl Bucket { if self.data.get(sz.0 as usize).is_none() { for i in self.data.len() as u64..(sz.0 + 1) { self.data.push(DataBucket::new( - self.drives.clone(), + Arc::clone(&self.drives), 1 << i, std::mem::size_of::() as u64, self.index.max_search, - self.stats.data.clone(), + Arc::clone(&self.stats.data), )) } } diff --git a/bucket_map/src/bucket_map.rs b/bucket_map/src/bucket_map.rs index 1babfb77bc..9386113f8d 100644 --- a/bucket_map/src/bucket_map.rs +++ b/bucket_map/src/bucket_map.rs @@ -162,9 +162,9 @@ impl BucketMap { let mut bucket = self.buckets[ix].write().unwrap(); if bucket.is_none() { *bucket = Some(Bucket::new( - self.drives.clone(), + Arc::clone(&self.drives), self.max_search, - self.stats.clone(), + Arc::clone(&self.stats), )); } let bucket = bucket.as_mut().unwrap();