-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
Summary
unnecessary_safety_comment
does not lint for "orphan" comments, i.e. the last (or only) comment.
Possibly related: #14553.
Possibly related: #14554.
Possibly related: #14555.
Lint Name
unnecessary_safety_comment
Reproducer
https://godbolt.org/z/GrjxKc9nW
I tried this code:
// This line should avoid #14553.
mod x {}
// SAFETY: ...
I expected to see this happen: lint.
Instead, this happened: no lint.
Same if it is a single comment:
// This line should avoid #14553.
// SAFETY: ...
Version
rustc 1.86.0 (05f9846f8 2025-03-31)
rustc 1.88.0-nightly (17ffbc81a 2025-04-04)
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
unnecessary_safety_comment
does not lint for adoc(hidden)
item #14555unnecessary_safety_comment
does not lint the first item of a module without a body #14554unnecessary_safety_comment
does not lint for the first line #14553