diff --git a/src/disc/read_error.rs b/src/disc/read_error.rs index a700b18..eccb294 100644 --- a/src/disc/read_error.rs +++ b/src/disc/read_error.rs @@ -369,6 +369,6 @@ mod tests { ctx.on_success(); assert_eq!(ctx.consecutive_good, 1); assert_eq!(ctx.consecutive_failures, 0); - assert_eq!(*ctx.damage_window.last().unwrap(), true); + assert!(*ctx.damage_window.last().unwrap()); } } diff --git a/src/halt.rs b/src/halt.rs index 23b5e1f..7000627 100644 --- a/src/halt.rs +++ b/src/halt.rs @@ -20,10 +20,11 @@ use std::sync::atomic::{AtomicBool, Ordering}; /// no `reset()` by design — construct a fresh `Halt` for a fresh /// operation. /// -/// Construct with [`Halt::new`]. We intentionally don't derive -/// `Default` — `Halt::new()` is more discoverable, matches the -/// stdlib `Mutex::new` / `Arc::new` convention, and keeps the -/// uncancelled-by-construction invariant in one named place. +/// Construct with [`Halt::new`] (or [`Halt::default`]). The `Default` +/// impl forwards to `new()` — both produce a fresh, uncancelled token. +/// The pair exists because clippy's `new_without_default` lint requires +/// `Default` whenever a public `new()` is present, even when the two +/// would do exactly the same thing. #[derive(Clone, Debug)] pub struct Halt(Arc); @@ -44,6 +45,12 @@ impl Halt { } } +impl Default for Halt { + fn default() -> Self { + Self::new() + } +} + #[cfg(test)] mod tests { use super::*; @@ -103,5 +110,4 @@ mod tests { handle.join().unwrap(); assert!(h.is_cancelled()); } - }