rust-lang / rust-lang/rust-clippy
Ignoring lints added after a given Rust version
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
It would be nice to have a way to make Clippy ignore all lints that were added starting with a certain Rust version.
This would be useful to minimize the chance of breaking the build in projects that use -D for particular lint groups (or -W with -Dwarnings): once a new Rust version is released, and somebody builds the project, new lints may get added to the group, which would make the build fail. It can also be used to keep builds warning-free for everybody until the new lints are cleaned up.
A workaround for those projects is listing every single lint to enable by hand. As an example, in the Linux kernel, when we unpinned the compiler version and started supporting a minimum Rust version, we needed to move all our Clippy lint groups to -W, including -Wclippy::all, to avoid unexpected warnings and thus breaking Clippy-enabled builds with upcoming Rust versions.
The already-existing versioning information ("Added in: 1.x.y" rendered in the docs) could be used to drive this.
(Also, since it got mentioned at some point, Clippy's msrv does not currently solve this: that one is meant to disable lints pertaining to language/library/... features introduced in newer versions (e.g. a lint that suggests using let else that wouldn't be able to be used in an old version), rather than disabling lints introduced in newer versions.)
From: https://github.com/rust-lang/rust-clippy/issues/11162#issuecomment-1637073962.
Cc @tgross35 @flip1995 (and @jonhoo since Philipp said Jon mentioned it too).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing Clippy's existing lint versioning information and the configuration documentation's msrv section, then compare those concepts with the requested behavior. Done means projects can select a Rust version and prevent lints added after it from entering enabled lint groups, while preserving the distinct purpose of msrv.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100