rust-lang/rustfix

Add a `--clippy` option

jyn514 opened this issue · 3 comments

Right now, there are two main interfaces for running fixes:

  1. `cargo fix [--tests|--benches|--lib]
  2. cargo clippy --fix

It's weird that they are so different - I would expect this to be a cargo fix --clippy option. Would it be possible for rustfix to add support so we can unify the interface?

cc @rust-lang/clippy

Aren't those flags completely handled by cargo?

I seem to remember that we had this discussion before in the cargo repo. I think it was in the context of making the clippy subcommand a first class citizen of cargo instead of having it as an external tool that adds this subcommand (which was rejected back then, because Clippy doesn't have to be installed). Having Clippy as a first class citizen would have had the advantage that cargo could also handle things like cargo fix --clippy. But since Clippy has to register itself as a subcommand, we also had to implement the --fix flag on our own.

This is the PR were this discussion took place: rust-lang/cargo#7382 (warning: it's really long!)

And here is the PR that tried adding cargo fix --clippy: rust-lang/cargo#7383

Thanks for the link! Yes, that would be a cargo change. I commented on the PR :)

ehuss commented

Closing as this isn't related to the rustfix library. I commented on the linked PR for the reasoning.