Fix multiple Default implementation caveats

This commit is contained in:
Zhang Junyang
2024-06-20 16:04:01 +00:00
committed by Tate, Hongliang Tian
parent 8633893bb9
commit d6714c4b47
7 changed files with 35 additions and 6 deletions

View File

@ -236,6 +236,7 @@ impl UserPreemption {
const PREEMPTION_INTERVAL: u32 = 100;
/// Creates a new instance of `UserPreemption`.
#[allow(clippy::new_without_default)]
pub const fn new() -> Self {
UserPreemption { count: 0 }
}

View File

@ -146,6 +146,12 @@ impl WaitQueue {
}
}
impl Default for WaitQueue {
fn default() -> Self {
Self::new()
}
}
/// A waiter that can put the current thread to sleep until it is woken up by the associated
/// [`Waker`].
///