rustfix icon indicating copy to clipboard operation
rustfix copied to clipboard

Allow filtering by lint

Open Manishearth opened this issue 2 years ago • 3 comments

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.

Manishearth avatar Sep 09 '21 18:09 Manishearth

also cc @ehuss for thinking about what the UX would be like from cargo's perspective

Manishearth avatar Sep 09 '21 18:09 Manishearth

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:

matthiaskrgr avatar Sep 10 '21 13:09 matthiaskrgr

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

gheoan avatar May 21 '22 16:05 gheoan