Skip to content

Add disabled-in-tests configuration to Clippy#156396

Open
smoelius wants to merge 2 commits into
rust-lang:mainfrom
smoelius:post-expect-filter
Open

Add disabled-in-tests configuration to Clippy#156396
smoelius wants to merge 2 commits into
rust-lang:mainfrom
smoelius:post-expect-filter

Conversation

@smoelius
Copy link
Copy Markdown
Contributor

This is a continuation of rust-lang/rust-clippy#15600. It adds an option to Clippy's configuration file so that arbitrary lints can be disabled when --test is passed to rustc.

Changes to the Rust compiler are needed to support the option. As @y21 noted in rust-lang/rust-clippy#15600 (comment), it would be surprising to disable a lint in tests and then see an unfulfilled lint expectation in non-test code. The approach taken by this PR is to filter out such diagnostics after Rust's expect -related code has run.

This PR is currently two commits:

When tested locally, the following commands pass:

  • ./x.py test
  • ./x.py test src/tools/clippy/tests

r? @flip1995

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 10, 2026

The Clippy subtree was changed

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 10, 2026
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. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants