Skip to content

Commit

Permalink
Change the trait bound Arc<K>: Borrow<Q> to K: Borrow<Q>
Browse files Browse the repository at this point in the history
Remove unnecessary `borrow` calls.
  • Loading branch information
tatsuya6502 committed Jul 16, 2022
1 parent 36765be commit 9d3d834
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/sync_base/base_cache.rs
Expand Up @@ -967,7 +967,7 @@ where
S: BuildHasher,
{
fn get_value_entry(&self, key: &Arc<K>, hash: u64) -> Option<TrioArc<ValueEntry<K, V>>> {
self.cache.get(hash, |k| (k.borrow() as &Arc<K>) == key)
self.cache.get(hash, |k| k == key)
}

fn remove_key_value_if(
Expand All @@ -984,9 +984,7 @@ where
let kl = self.maybe_key_lock(key);
let _klg = &kl.as_ref().map(|kl| kl.lock());

let maybe_entry = self
.cache
.remove_if(hash, |k| (k.borrow() as &Arc<K>) == key, condition);
let maybe_entry = self.cache.remove_if(hash, |k| k == key, condition);
if let Some(entry) = &maybe_entry {
if self.is_removal_notifier_enabled() {
self.notify_single_removal(Arc::clone(key), entry, RemovalCause::Explicit);
Expand Down

0 comments on commit 9d3d834

Please sign in to comment.