Skip to content

Commit

Permalink
get rid of unneeded mut and refactor addref
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Sep 2, 2021
1 parent 57f5135 commit eccdb5e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions runtime/src/accounts_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl<T: IsCached> WriteAccountMapEntry<T> {
.build()
}

pub fn slot_list(&mut self) -> &SlotList<T> {
pub fn slot_list(&self) -> &SlotList<T> {
&*self.borrow_slot_list_guard()
}

Expand All @@ -201,10 +201,6 @@ impl<T: IsCached> WriteAccountMapEntry<T> {
self.with_slot_list_guard_mut(user)
}

pub fn ref_count(&self) -> &AtomicU64 {
&self.borrow_owned_entry().ref_count
}

// create an entry that is equivalent to this process:
// 1. new empty (refcount=0, slot_list={})
// 2. update(slot, account_info)
Expand Down Expand Up @@ -329,7 +325,7 @@ impl<T: IsCached> WriteAccountMapEntry<T> {
});
if addref {
// If it's the first non-cache insert, also bump the stored ref count
self.ref_count().fetch_add(1, Ordering::Relaxed);
self.borrow_owned_entry().add_un_ref(true);
}
}
}
Expand Down

0 comments on commit eccdb5e

Please sign in to comment.