diff --git a/lib/Cargo.toml b/lib/Cargo.toml index dda2fbf..60aba78 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -41,6 +41,11 @@ unreachable = "deny" # 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. indexing_slicing = "deny" +# Require every `#[allow(...)]` to carry a `reason = "..."` explaining why the +# lint is suppressed. Suppressions silence the linter, so each one should be +# justified in-place; this keeps them auditable and prevents stale or +# copy-pasted allows from accumulating unexplained. +allow_attributes_without_reason = "deny" # Forbid string slicing (`&s[i..j]`) which panics when a bound falls inside a # UTF-8 multi-byte char. `indexing_slicing` covers arrays/slices/`Vec`, not `str`; # this closes that remaining panic gap. Prefer `.get(i..j)` for fallible slicing. diff --git a/lib/src/daemon.rs b/lib/src/daemon.rs index b858fb6..a0df809 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 use unwrap/expect/panic for brevity; only production code must stay panic-free" +)] mod tests { use super::*; diff --git a/lib/src/download.rs b/lib/src/download.rs index d242d15..b31c86a 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 use unwrap/expect/panic for brevity; only production code must stay panic-free" +)] mod tests { use super::*; use std::io::Write; diff --git a/lib/src/github.rs b/lib/src/github.rs index 90d9087..8054f26 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 use unwrap/expect/panic for brevity; only production code must stay panic-free" +)] mod tests { use super::*; diff --git a/lib/tests/e2e_install.rs b/lib/tests/e2e_install.rs index d35ab28..5020d4a 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 = "tests use unwrap/expect/panic for brevity; only production code must stay panic-free" +)] use std::fs; use std::path::PathBuf;