From 830d8f3cb14f9a1412a227cc9b15058642c090a3 Mon Sep 17 00:00:00 2001 From: Serge Barral Date: Sun, 8 Sep 2024 22:43:36 +0200 Subject: [PATCH] Add stricter checks, implement Debug where needed --- src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fd42ac1..feb695c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,6 +68,8 @@ //! assert_eq!(v, 42); //! }); //! ``` +#![warn(missing_docs, missing_debug_implementations, unreachable_pub)] + mod loom_exports; use std::future::Future; @@ -83,6 +85,7 @@ use loom_exports::sync::Mutex; use pin_project_lite::pin_project; /// An object that can receive or send notifications. +#[derive(Debug)] pub struct Event { wait_set: WaitSet, } @@ -220,6 +223,7 @@ unsafe impl Send for Notifier {} unsafe impl Sync for Notifier {} /// A future that can be `await`ed until a predicate is satisfied. +#[derive(Debug)] pub struct WaitUntil<'a, F: FnMut() -> Option, T> { state: WaitUntilState, predicate: F, @@ -391,7 +395,7 @@ impl<'a, F: FnMut() -> Option, T> Future for WaitUntil<'a, F, T> { } /// State of the `WaitUntil` future. -#[derive(PartialEq)] +#[derive(Debug, PartialEq)] enum WaitUntilState { Idle, Polled(NonNull), @@ -449,6 +453,7 @@ where /// /// The set wraps a Mutex-protected list of notifiers and manages a flag for /// fast assessment of list emptiness. +#[derive(Debug)] struct WaitSet { list: Mutex, is_empty: AtomicBool, @@ -689,7 +694,7 @@ impl Default for WaitSet { } } -#[derive(Default)] +#[derive(Default, Debug)] struct List { front: Option>, back: Option>,