rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Suggest `#[expect(...)]` instead of `#[allow(...)]` to ensure relevance

Open nyurik opened this issue 1 year ago • 2 comments

What it does

With the introduction of #[expect] in 1.81.0, it is now possible to ensure that lint is actually relevant - i.e. there is no "allow" that does not get used. This lint would offer to replace all allow with expect

Advantage

  • keep lint declarations relevant to the actual code
  • avoids useless lint declarations, keeping the code tidy

Drawbacks

No idea who would want to "allow" just in case...

Example

#![allow(some_lint)]

Could be written as:

#![expect(some_lint)]

nyurik avatar Oct 02 '24 22:10 nyurik