Skip to content
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

cargo fix cmd no longer works #5358

Closed
matthiaskrgr opened this issue Mar 23, 2020 · 6 comments
Closed

cargo fix cmd no longer works #5358

matthiaskrgr opened this issue Mar 23, 2020 · 6 comments

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Mar 23, 2020

The https://github.com/rust-lang/rust-clippy#automatically-applying-clippy-suggestions states we can run cargo fix -Z unstable-options --clippy but this no longer works:

error: Found argument '--clippy' which wasn't expected, or isn't valid in this context

USAGE:
    cargo fix -Z <FLAG>...

For more information try --help

Maybe it's related to rust-lang/cargo#7533 ?
EDIT: looks like it: rust-lang/cargo#7533 (comment)

@flip1995
Copy link
Member

ping @yaahc Do you have an idea, what's going on here and what we can do about this?

@yaahc
Copy link
Member

yaahc commented Mar 23, 2020

My guess is that cargo fix was shelling out to clippy preview which got removed and now it needs to use RUSTC_WORKSPACE_WRAPPER instead now, I can open a PR to fix it, guess this means my PR finally merged into nightly 😅

@flip1995
Copy link
Member

Thanks! It would be great, if you could provide a fix for this.

@yaahc
Copy link
Member

yaahc commented Mar 23, 2020

Okay so I just checked a little deeper and it looks like cargo-fix isn't an external subcommand anymore, its built into cargo, and I think I remember we decided that we didn't want to have mentions of clippy in cargo itself which is what this PR does rust-lang/cargo#7533, it completely removes all special case integration for clippy and adds the functionality to cargo that clippy would need to be implemented as an external subcommand.

So the plan going forward is to have fix be invoked by clippy's external subcommand cargo clippy --fix and not support cargo fix --clippy for the time being. If we wanted to have a clippy option on fix it would have to go back to knowing how to detect if clippy-driver is available and would have to pick a version which is something we're aiming to avoid afaik.

I'm currently working on the cargo clippy --fix version and should hopefully have something working soon. Sorry for the inconvenience, this particular bit of integration has gone through a few iterations between october and now as we figured out the best way to structure everything.

so yea short term @matthiaskrgr you should be able to still apply them on nightly by running

RUSTC_WORKSPACE_WRAPPER=/path/to/clippy-driver cargo fix -Zunsable-options

Which is essentially how the new cargo-clippy subcommand will work going forward.

@yaahc
Copy link
Member

yaahc commented Mar 23, 2020

Here we go, WIP

#5363

@flip1995 flip1995 mentioned this issue Mar 31, 2020
6 tasks
@ebroto
Copy link
Member

ebroto commented Dec 13, 2020

Closing this as it was fixed by #5363.

I will add the missing help for the --fix command after/if rust-lang/cargo#8976 is merged in a stabilization PR here in Clippy 🤞

@ebroto ebroto closed this as completed Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants