Skip to content

Commit

Permalink
refactor(header): rename method to follow naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored and seanmonstar committed Feb 19, 2024
1 parent 63e7d63 commit 4785cdd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/header/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ impl<T> HeaderMap<T> {

if danger || num_displaced >= DISPLACEMENT_THRESHOLD {
// Increase danger level
self.danger.to_yellow();
self.danger.set_yellow();
}

index
Expand Down Expand Up @@ -1524,15 +1524,15 @@ impl<T> HeaderMap<T> {

if load_factor >= LOAD_FACTOR_THRESHOLD {
// Transition back to green danger level
self.danger.to_green();
self.danger.set_green();

// Double the capacity
let new_cap = self.indices.len() * 2;

// Grow the capacity
self.grow(new_cap);
} else {
self.danger.to_red();
self.danger.set_red();

// Rebuild hash table
for index in self.indices.iter_mut() {
Expand Down Expand Up @@ -3223,7 +3223,7 @@ impl Danger {
matches!(*self, Danger::Red(_))
}

fn to_red(&mut self) {
fn set_red(&mut self) {
debug_assert!(self.is_yellow());
*self = Danger::Red(RandomState::new());
}
Expand All @@ -3232,13 +3232,13 @@ impl Danger {
matches!(*self, Danger::Yellow)
}

fn to_yellow(&mut self) {
fn set_yellow(&mut self) {
if let Danger::Green = *self {
*self = Danger::Yellow;
}
}

fn to_green(&mut self) {
fn set_green(&mut self) {
debug_assert!(self.is_yellow());
*self = Danger::Green;
}
Expand Down

0 comments on commit 4785cdd

Please sign in to comment.