0.18 round 1+2 integration fixes

Two clippy issues surfaced when round 1 polish + round 2 FrameSink
migrations both landed on libfreemkv main:

- src/halt.rs: clippy::new_without_default fires when a public new()
  exists without Default. The polish pass dropped the derive thinking
  it was redundant — clippy disagrees, so add a manual impl that
  forwards to new(). Doc-comment notes why both exist.

- src/disc/read_error.rs:372: pre-existing
  assert_eq!(.., true) trips clippy::bool_assert_comparison. Pre-0.18
  precommits passed because that lint sat outside the gate; the
  round-2 commits brought enough new clippy surface that it now
  shows up. Trivial cleanup: assert!(...) instead of assert_eq!.

Single contributor: MattJackson.
This commit is contained in:
MattJackson
2026-05-09 10:00:06 -07:00
parent 9884346c24
commit bbfb887a35
2 changed files with 12 additions and 6 deletions
+11 -5
View File
@@ -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<AtomicBool>);
@@ -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());
}
}