diff --git a/lib/Cargo.toml b/lib/Cargo.toml index dda2fbf..eefa0c8 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -37,6 +37,9 @@ unwrap_used = "deny" expect_used = "deny" panic = "deny" unreachable = "deny" +# Require every `#[allow(...)]` to record a `reason = "..."`, so each opt-out of +# the panic-safety set above is self-documenting and auditable in review. +allow_attributes_without_reason = "deny" # Forbid direct indexing/slicing (`a[i]`, `a[i..j]`) which panics out of bounds. # Completes the no-panic family above by closing the remaining common panic # source; prefer `.get(i)` / `.get(i..j)` so malformed input is handled, not fatal. diff --git a/lib/src/daemon.rs b/lib/src/daemon.rs index b858fb6..690ac08 100644 --- a/lib/src/daemon.rs +++ b/lib/src/daemon.rs @@ -197,7 +197,12 @@ pub fn restart_if_running(binary_path: &Path) -> Result { } #[cfg(test)] -#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] +#[allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + reason = "tests deliberately unwrap/panic to fail fast on broken fixtures" +)] mod tests { use super::*; diff --git a/lib/src/download.rs b/lib/src/download.rs index d242d15..b170f00 100644 --- a/lib/src/download.rs +++ b/lib/src/download.rs @@ -48,7 +48,8 @@ pub fn download_and_verify(client: &Client, info: &ReleaseInfo) -> Result Result, String> { } #[cfg(test)] -#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] +#[allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + reason = "tests deliberately unwrap/panic to fail fast on broken fixtures" +)] mod tests { use super::*; use std::io::Write; diff --git a/lib/src/github.rs b/lib/src/github.rs index 90d9087..ca43d85 100644 --- a/lib/src/github.rs +++ b/lib/src/github.rs @@ -12,7 +12,10 @@ pub struct VersionInfo { pub struct ReleaseInfo { /// Retained for consumers that need the resolved tag (e.g. for display/logging). - #[allow(dead_code)] + #[allow( + dead_code, + reason = "retained for consumers that need the resolved tag (e.g. for display/logging)" + )] pub tag: String, pub asset_url: String, pub checksums_url: String, @@ -179,7 +182,8 @@ pub fn parse_checksum(checksums_text: &str, asset_name: &str) -> Result Result Result { } #[cfg(test)] -#[allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] +#[allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + reason = "tests deliberately unwrap/panic to fail fast on broken fixtures" +)] mod tests { use super::*; diff --git a/lib/tests/e2e_install.rs b/lib/tests/e2e_install.rs index d35ab28..a9c1aaf 100644 --- a/lib/tests/e2e_install.rs +++ b/lib/tests/e2e_install.rs @@ -5,7 +5,12 @@ //! //! Run with: `cargo test --test e2e_install -- --test-threads=1` -#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + reason = "end-to-end tests deliberately unwrap/panic to fail fast on broken fixtures" +)] use std::fs; use std::path::PathBuf;