diff --git a/src/no_std.rs b/src/no_std.rs index fabf892..051aeeb 100644 --- a/src/no_std.rs +++ b/src/no_std.rs @@ -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 @@ -412,7 +412,7 @@ pub(crate) struct ListenerSlab { start: Option, /// The number of notified entries in the list. - pub(crate) notified: usize, + notified: usize, /// The total number of listeners. len: usize, @@ -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. @@ -539,6 +534,7 @@ impl ListenerSlab { } } } + self.len -= 1; Some(state) }