Skip to content

Lint: Suggestion #[expect] over #[allow] #10468

Closed
@xFrednet

Description

@xFrednet

What it does

The #![feature(lint_reasons)] adds a new #[expect] attribute as described in RFC 2383.

It would be cool to have a restriction lint, that suggests replacing all #[allow] attributes with #[expect].

Lint Name

allow_attribute

Category

restriction

Notes

  • This should be a restriction lint, as the allow attribute has valid use cases.
  • The lint has to check for the lint_reasons feature.
  • The lint should probably ignore crate attributes, or at least have an option to allow them. Crate attributes are #![attr] in the root of the crate.

Example

#[allow(unused)]
let x = 0;

Could be written as:

#[expect(unused)]
let x = 0;

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsgood first issueThese issues are a good way to get started with Clippy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions