Clippy · Correctness
Unsafe block without a SAFETY comment
clippy::undocumented_unsafe_blocks
Precede the block with a `// SAFETY:` comment stating the invariant that makes each operation in it sound.
- Category
- Correctness
- Default level
- warn
- Tier
- P2
- Producer
- Clippy
- Diff scope
- line
Not a defect when
The block is in generated FFI bindings or macro output nobody edits by hand, and the safety argument is documented once on the generator or the enclosing module.
What it reads
Clippy, with the compiler behind it. The only pass that compiles.
Tier
Ordinary defect.
The tier bounds how severe a rule may be; its category bounds the tier.Diff scope
The changed line itself.
What--scope contextual looks at to decide whether a change caused the finding.Change it
Turn it off, or make it blocking, without touching the code it flags:
rust-doctor --rule clippy::undocumented_unsafe_blocks=off .
rust-doctor --rule clippy::undocumented_unsafe_blocks=error .