#[allow(unsafe_code)]
should be allowed after SAFETY:
docs
#8679
Labels
C-bug
Category: Clippy is not doing the correct thing
Summary
PR #8450 changed it so that nothing can appear between the
SAFETY:
comment and the unsafe block it is documenting, while the intention behind this change is good, I think it might be too aggressive in the specific case of using a#[allow(unsafe_code)]
on the sameunsafe
block being documented.Reproducer
I tried this code:
I expected to see this happen:
No lint is triggered, the safety documentation applies to the immediately following
unsafe
block that has one more more attributes on it.Instead, this happened:
Moving
#[allow(unsafe_code)]
up above theSAFETY
comment no longer triggers the lint, but IMO this is a regression in readability and could lead users to actually increase the scope of an#[allow(unsafe_code)]
rather than having it scoped as tightly as possible.Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: