unnecessary_safety_comment
does not lint for a doc(hidden)
item · Issue #14555 · rust-lang/rust-clippy (original) (raw)
Summary
unnecessary_safety_comment
does not lint for a doc(hidden)
item (if above it).
Possibly related: #14553.
Possibly related: #14554.
Possibly related: #14556.
Lint Name
unnecessary_safety_comment
Reproducer
https://godbolt.org/z/Wxde5d7f4
I tried this code:
// This line should avoid #14553.
// SAFETY: ... mod x {}
// SAFETY: ... #[doc(hidden)] mod y {}
#[doc(hidden)] // SAFETY: ... mod z {}
I expected to see this happen: Three lints, for all safety comments.
Instead, this happened: The safety comment for y
is not linted.
Version
rustc 1.86.0 (05f9846f8 2025-03-31)
rustc 1.88.0-nightly (17ffbc81a 2025-04-04)