Skip to content

Add blanket_allow_warnings lint - #17274

Open
mehbark wants to merge 5 commits into
rust-lang:mainfrom
mehbark:blanket_allow_warnings
Open

mehbark wants to merge 5 commits into
rust-lang:mainfrom
mehbark:blanket_allow_warnings

Conversation

@mehbark

@mehbark mehbark commented Jun 19, 2026 •

Copy link
Copy Markdown

Based on #1648, this lint checks for allow or expect attributes with the warnings group; for example, #![allow(warnings)] instead of #![allow(non_snake_case)].
This is generally suspicious (though perhaps not the literal category), especially if you're using clippy. The use of "blanket" comes from blanket_clippy_restriction_lints.

Some questions about this lint that I don't know the answers to:

  • Is this even something we want?
  • What's the right name for this?
  • What category is this?
  • Should this be extended to check for #[allow(clippy)]?
  • Would a customizable allow/except denylist be better?
  • How do we issue an "unsilenceable" warning instead of an error?

Also the error messages, documentation, and testing could be better.


changelog: [blanket_allow_warnings]: new lint

@rustbot rustbot added the needs-fcp PRs that add, remove, or rename lints and need an FCP label Jun 19, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 19, 2026
@rustbot

rustbot commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @llogiq (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 8 candidates
  • 8 candidates expanded to 8 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@github-actions

github-actions Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Lintcheck changes for f928210

Lint Added Removed Changed
clippy::blanket_allow_warnings 6 0 0

This comment will be updated if you push new changes

@DanielEScherzer DanielEScherzer left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

community review - inline suggestion

View changes since this review

Comment thread clippy_lints/src/attrs/mod.rs Resolved
@mehbark
mehbark force-pushed the blanket_allow_warnings branch from c96e11b to 1540858 Compare July 10, 2026 18:46
@blyxyas

blyxyas commented Jul 31, 2026

Copy link
Copy Markdown
Member

Hello @mehbark, mind if we use your PR for some teaching?
@medzernik, I think that we've never implemented a lint, could you take a look here? It's a pretty simple lint, so I'm sure you'll have no problems! (=ↀωↀ=)

@rustbot

This comment has been minimized.

@rustbot

rustbot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in clippy_lints/src/doc

cc @notriddle

@rustbot

rustbot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Aug 12, 2026

@medzernik medzernik left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Thanks for the PR. Could you please rebase it so it has no merge commits? It makes the review process basically impossible with 940+ changed files.

Once that is done, I can continue to review. Thanks!

View changes since this review

@rustbot

This comment has been minimized.

@mehbark
mehbark force-pushed the blanket_allow_warnings branch from ca284d2 to f928210 Compare August 17, 2026 04:05
@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Aug 17, 2026

@medzernik medzernik left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions about this lint that I don't know the answers to:

Is this even something we want?
What's the right name for this?
What category is this?
Should this be extended to check for #[allow(clippy)]?
Would a customizable allow/except denylist be better?
How do we issue an "unsilenceable" warning instead of an error?
Also the error messages, documentation, and testing could be better.

I kinda like the lint idea. I think it being an optional lint would help environments, where there needs to be stricter control over the amount of allowed lints to go through - especially in CI scenarios.

I think the name is fine? Unless there are other opinions :D

The category I would actually suggest maybe the clippy::suspicious one, it really does feel like something is off if someone has to allow an entire category blanked file.

Customizable allow and deny list would be very nice, however I do see value (from my work experience) of a global ban on allow warnings, especially for CI/CD tests.

I'm not quite sure how do we issue an unsilenceable warning yet, I think @blyxyas would know much better than me in this case 😶

I also ran this across the lintcheck groups and there is indeed just one occurence of this lint being applied - in the regex crate in the builders.rs file on line 1:1 where someone actually used this. I think the impact on regular crates is therefore minimal and could work well for those who opt-in as an additional safeguard.

I tried the lint with some macros and edge cases, from what I've tried it seemed to work nice.

I think so far just removing the TODO and maybe some additional comments would be nice, after that's done I will approve, but of course the final approval is on @blyxyas.

Thanks!

View changes since this review

pub(super) fn check<'cx>(cx: &EarlyContext<'cx>, name: Symbol, items: &[MetaItemInner], attr: &'cx Attribute) {
for lint in items {
// Check if the attribute is in an external macro and therefore out of the developer's control
// TODO?: (taken from `allow_attributes_without_reason`; should this be an `attrs` util? )

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover TODO here.

@rustbot

rustbot commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #17678) made this pull request unmergeable. Please resolve the merge conflicts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp PRs that add, remove, or rename lints and need an FCP S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants