-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move cargo-clippy into cargo #3837
Comments
I think as a first step we should write a very basic We can then do the back and forth of testing it with clippy to ensure it works, and eventually rename and ship it. We should probably continue to ship Once we have this there are a bunch of nice changes we can make: e.g. we can modify the argument parsing so that you can just do This also helps integration with cargo fix, since that can now be wholly solved on the cargo side. |
One implementation issue is that rustup currently does not export a clippy-driver binary, we should change it to do this. |
This could also be handled by using the current exe path I guess. |
Filed rust-lang/rustup#1678 I do have concerns as to how this will work for non-rustup users. |
@yaahallo is looking into implementing this |
Shouldn't have been closed |
Where should I file bugs about clippy-preview? rust-clippy or cargo? Context: cargo clippy-preview --help
cargo clippy-preview --all-targets -Z unstable-options -- -W clippy::all
cargo clippy-preview --all-targets -Z unstable-options -W clippy::all
The actual value passed to |
It's not supposed to be used yet, that behavior is expected. |
I'm aware, I don't use it actively, I've just thrown it into my stack in such a way I can preemptively test it, so I can identify anything that might need to be addressed before it progresses towards some kind of usable thing. Just trying to be helpful, not annoying :) |
Yeah, so that stuff is on the list of things to make work, but it's not yet fixed. I should file some subissues for people to work on, let me know if you're interested in helping! |
I think this may have been inadvertently closed (GitHub seems to be a little too aggressive scanning commit messages when pushed). Although, given that, I'm a little uncertain which steps are left to transition to |
@ehuss I've been waiting on a review for the change below before proceeding with the last few features for the new clippy. |
Oh, and also for step 2 of removing |
I would wait a bit because iirc there are situations where you have an older cargo and a newer toolchain, so we should wait a couple cycles for this. |
I'm curious what the plan is for For context, I prefer to use clippy like a To achieve this, currently I use the |
No plan currently, but it should be easy to add once the main stuff is done. |
Clippy currently does not lint the code if it comes right after a cargo check. rust-lang/rust-clippy#3837
Update We have decided to not move cargo-clippy into Cargo, but instead provide better integration points so that it is not necessary. These changes just landed on nightly, and you can test them with:
The main enhancement here is that clippy will share the cache with Additionally, a new More details may be found at rust-lang/cargo#8143 and #4612. |
What does this imply for non-rustup users who wish to use clippy? |
Nothing, AFAICT. |
To rephrase, does that imply clippy will never (again) be available on non-rustup installs (which seems to have been hinted at as a side-effect earlier in this issue). |
I mean you can always clone the repo and run What is your current setup now and how do you install Clippy right now? |
|
No, there is no easier way for this to work. This is up to the package maintainers to provide. We recommend the rustup method. |
Out of curiosity, is this decision permanent? If so, should this issue stay open? |
Yeah this can be closed. We got most of the same benefits from the workspace wrapper work. |
See rust-lang/cargo#6664 (comment) for some context.
Currently
cargo clippy
is a thin wrapper script around Cargo that invokescargo check
with a RUSTC_WRAPPER: https://github.com/rust-lang/rust-clippy/blob/8dfabdf11c6cdaffd7c6e6552a6ead8d52c49b10/src/main.rsIt does some additional hacks to support the clippy dogfood test and passing down arguments.
We should move this into cargo proper, like rustc: Ideally it's just a copy of
cargo check
that sets a different rustc executable (temporarily can be done by overriding RUSTC_WRAPPER, but the better solution probably involves modifyingconfig.rustc()
https://github.com/rust-lang/cargo/blob/716b02cb4c7b75ce435eb06defa25bc2d725909c/src/cargo/util/config.rs#L194-L215Steps:
clippy-driver
#4173Perhaps make-Wlintname
work as a shortcut for-Wclippy::lintname
The text was updated successfully, but these errors were encountered: