Skip to content

Conversation

@Alexendoo
Copy link
Member

@Alexendoo Alexendoo commented Oct 29, 2025

Fixes #13007

deprecated_cfg_attr now also lints inner attributes since it can catch the crate level ones, the suggestion is now MaybeIncorrect as there were some existing cases where the suggestion isn't valid and this adds some new ones

deprecated_clippy_cfg_attr uses stripped_cfg_items in addition to a regular early pass as it will typically be in a cfg that evaluates to false

non_minimal_cfg can't use stripped_cfg_items here though since it only stores the part of the cfg that evaluated to false whereas the lint needs the wider context, this means the lint no longer fires on code that is cfgd out, which may or may not be expected

non_minimal_cfg now also lints cfg_attr conditions and lints both empty any() and all(), suggesting to replace them with true/false as long as the MSRV is 1.88 (rust-lang/rust#138632)

changelog: [non_minimal_cfg] now lints empty any() and conditions in #[cfg_attr]s

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 29, 2025

r? @y21

rustbot has assigned @y21.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@github-actions
Copy link

github-actions bot commented Oct 29, 2025

Lintcheck changes for ddc2f29

Lint Added Removed Changed
clippy::deprecated_clippy_cfg_attr 14 0 0

This comment will be updated if you push new changes

@Alexendoo Alexendoo force-pushed the remove-pre-expansion-pass branch from 825beb0 to 870725a Compare October 29, 2025 16:30
Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

This is going to be a general regression on all these lints with non_minimal_cfg taking the biggest hit. Anything within a stripped out item will not be linted, including other attributes on said item. At the minimum I would note this in the known problems of non_minimal_cfg.

In practice actually working properly with lint attributes is probably more important. When cfg's are used solely to add things (e.g. only using #[cfg(feature = ...)]) then running clippy in a way that enables everything will work just fine. Using them for mutually exclusive paths (e.g. target based) will be a problem, especially if it's for small things like setting constant values. When the mutually exclusive parts are large chunks of code clippy would need to be run once for each path to lint them properly anyways.

View changes since this review

@Alexendoo Alexendoo force-pushed the remove-pre-expansion-pass branch 5 times, most recently from ac2220f to b21c720 Compare November 2, 2025 15:58
@rustbot

This comment has been minimized.

@Alexendoo Alexendoo force-pushed the remove-pre-expansion-pass branch from b21c720 to d727406 Compare November 27, 2025 18:39
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@Alexendoo Alexendoo force-pushed the remove-pre-expansion-pass branch from d727406 to ddc2f29 Compare December 5, 2025 16:45
@rustbot
Copy link
Collaborator

rustbot commented Dec 5, 2025

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.

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

Labels

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.

non_minimal_cfg suppression sometimes not effective

4 participants