rustfix
rustfix copied to clipboard
Allow filtering by lint
Sometimes a specific lint is the bulk of the suggestions. It would be cool if rustfix supported filtering by lint, enabling cargo clippy --fix=absurd-extreme-comparisons
or whatever.
also cc @ehuss for thinking about what the UX would be like from cargo's perspective
You can already do this "manually" today with the old -Aall -Wlint hack:
cargo clippy --fix -- -Aclippy::all -Wclippy::redundant_clone
will only fix redundant_clone warnings.
But having a dedicated --only=a,b,c flag or something like that would be bit easier to use for sure. :smile:
For direct rustc invocations this can be achieved using --force-warn=unused_imports -Awarnings
.
Relevant documentation:
https://doc.rust-lang.org/rustc/lints/groups.html
https://doc.rust-lang.org/rustc/lints/levels.html#via-compiler-flag