Unsafe attributes support (unnecessary_safety_comment) · Issue #13317 · rust-lang/rust-clippy (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@ojeda

Description

@ojeda

What it does

Unsafe attributes have been stabilized (rust-lang/rust#128771, rust-lang/rust#123757), thus it would be nice to have a lint that ensures // SAFETY comments are not written for safe attributes.

Since unnecessary_safety_comment covers impls too, perhaps it should also cover this too, although it may be best to possibly split them (but that is a different issue).

See #13316 as well.

Advantage

No response

Drawbacks

No response

Example

// SAFETY: ... #[derive(Debug)] struct S;

Should be written as:

#[derive(Debug)] struct S;