Skip to content

(Big performance change) Do not run lints that cannot emit#125116

Merged
bors merged 7 commits intorust-lang:masterfrom
blyxyas:ignore-allowed-lints-final
Oct 26, 2024
Merged

(Big performance change) Do not run lints that cannot emit#125116
bors merged 7 commits intorust-lang:masterfrom
blyxyas:ignore-allowed-lints-final

Conversation

@blyxyas
Copy link
Member

@blyxyas blyxyas commented May 14, 2024

Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had #![allow]ed them. This PR changes that. This change would improve both the Rust lint infrastructure and Clippy, but Clippy will see the most benefit, as it has about 900 registered lints (and growing!)

So yeah, with this little patch we filter all lints pre-linting, and remove any lint that is either:

  • Manually #![allow]ed in the whole crate,
  • Allowed in the command line, or
  • Not manually enabled with #[warn] or similar, and its default level is Allow

As some lints need to run, this PR also adds loadbearing lints. On a lint declaration, you can use the @eval_always = true marker to label it as loadbearing. A loadbearing lint will never be filtered (it will always run)

Fixes #106983

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

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't run late lints that are disabled in the entire crate