Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint #[level()] attribute without lint reason (#![feature(lint_reasons)]) #8502

Closed
xFrednet opened this issue Mar 3, 2022 · 0 comments · Fixed by #8504
Closed

Lint #[level()] attribute without lint reason (#![feature(lint_reasons)]) #8502

xFrednet opened this issue Mar 3, 2022 · 0 comments · Fixed by #8504
Assignees
Labels
A-lint Area: New lints

Comments

@xFrednet
Copy link
Member

xFrednet commented Mar 3, 2022

What it does

It checks for level attributes without a reason.

I think it would be good to have a config value that sets the minimum lint level of the #[level()] attribute. By default, it should only warn for allow end expect

I actually don't think that this actually requires a config value :)

Lint Name

allow_lint_without_reason

Category

restriction

Advantage

Enforces the user to reason about allowed lints

Drawbacks

Updating current code bases will take quite some work

Example

#![feature(lint_reasons)]

#![allow(clippy::some_lint)]

Could be written as:

#![feature(lint_reasons)]

#![allow(clippy::some_lint, reason = "False positive rust-lang/rust-clippy#1002020")]

@rustbot claim

@xFrednet xFrednet added the A-lint Area: New lints label Mar 3, 2022
bors added a commit that referenced this issue Mar 4, 2022
…1995

Add lint to detect `allow` attributes without reason

I was considering putting this lint into the pedantic group. However, that would result in countless warnings for existing projects. Having it in restriction also seems good to me 🙃 (And now I need sleep 💤 )

---

changelog: New lint [`allow_lint_without_reason`] (Requires the `lint_reasons` feature)

Closes: #8502
@bors bors closed this as completed in 48d5494 Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant