Skip to content

Commit

Permalink
Forgot to adjust length in remove()
Browse files Browse the repository at this point in the history
  • Loading branch information
notgull committed Mar 31, 2023
1 parent 17952d6 commit 8208309
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/no_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl Drop for ListGuard<'_> {
}

// Update the atomic `notified` counter.
let notified = if list.notified < list.len() {
let notified = if list.notified < list.len {
list.notified
} else {
core::usize::MAX
Expand Down Expand Up @@ -412,7 +412,7 @@ pub(crate) struct ListenerSlab {
start: Option<NonZeroUsize>,

/// The number of notified entries in the list.
pub(crate) notified: usize,
notified: usize,

/// The total number of listeners.
len: usize,
Expand All @@ -436,11 +436,6 @@ impl ListenerSlab {
}
}

/// Get the number of entries in the list.
pub(crate) fn len(&self) -> usize {
self.listeners.len() - 1
}

/// Inserts a new entry into the list.
pub(crate) fn insert(&mut self, state: State) -> NonZeroUsize {
// Add the new entry into the list.
Expand Down Expand Up @@ -539,6 +534,7 @@ impl ListenerSlab {
}
}
}
self.len -= 1;

Some(state)
}
Expand Down

0 comments on commit 8208309

Please sign in to comment.