Skip to content

Unsafe attributes support (unnecessary_safety_comment) #13317

Open
@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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions