Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
consolidate similar fns
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi authored and haoran committed Aug 16, 2022
1 parent 8c791f8 commit 9442a01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions runtime/src/ancestors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ impl Ancestors {
self.ancestors.get_all()
}

pub fn get(&self, slot: &Slot) -> bool {
self.ancestors.contains(slot)
}

pub fn remove(&mut self, slot: &Slot) {
self.ancestors.remove(slot);
}
Expand Down Expand Up @@ -182,10 +178,10 @@ pub mod tests {
let key = item.0;
min = std::cmp::min(min, *key);
max = std::cmp::max(max, *key);
assert!(ancestors.get(key));
assert!(ancestors.contains_key(key));
}
for slot in min - 1..max + 2 {
assert_eq!(ancestors.get(&slot), hashset.contains(&slot));
assert_eq!(ancestors.contains_key(&slot), hashset.contains(&slot));
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/status_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl<T: Serialize + Clone> StatusCache<T> {
if let Some(stored_forks) = keymap.get(key_slice) {
let res = stored_forks
.iter()
.find(|(f, _)| ancestors.get(f) || self.roots.get(f).is_some())
.find(|(f, _)| ancestors.contains_key(f) || self.roots.get(f).is_some())
.cloned();
if res.is_some() {
return res;
Expand Down

0 comments on commit 9442a01

Please sign in to comment.