clippy::undocumented_unsafe_blocks reports incorrectly when statement spilt onto multiple lines #11311
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
Having code with an unsafe block that splits the unsafe statement onto multiple lines, erroneously reports there is an clippy::undocumented_unsafe_blocks issue.
The code before running "cargo fmt" which generates no clippy issue:
The code after running "cargo fmt" which generates a false positive clippy issue:
Note that moving the safety comment down one line (into the middle of the statement) does eliminate the clippy error report. However, this is disruptive to the readability of the code. Also, it is undesirable that running "cargo fmt" causes different behavior in clippy:
Lint Name
clippy::undocumented_unsafe_blocks
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No error
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: