-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
initial working version of cargo fix --clippy #7069
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
The argument pass-through logic doesn't currently work and I dont know why. When I make it output the command that it is running before shelling out to clippy-driver it has the arguments that I added. And if I copy paste that command and run it manually the arg works and it suppresses the warning I was trying to allow. But when it runs via cargo fix it still outputs the warning. I initially assumed it was something clippy was doing to force allowed lints to output, but trying to pass |
Actually I think it is doing stuff, just very silently. When I put poorly formatted arguments into the passthrough list it silently fails and doesnt apply any changes, and instead warns on everything. My guess is that there is a final step after applying all fixes where it doesn't capture json output and instead just lets it output the remaining warnings to the user, and that the args im passing through aren't being applied to that step. |
It seems to be outputting leftover lints at least twice, possibly equal to the number of times it is invoked. |
@ehuss RE: The metadata already includes a hash of
Is it fair to say this should be sufficient for our needs and that I don't need to add the path and timestamp of the rustc binary to the metadata hash? If this is sufficient then I think the only thing I need to do is write tests and make sure it passes CI and then get it through review. Woooo! |
the clippy args passthrough only allows one arg per instance of the flag and does not resplit on spaces, as such it should be more obvious to the user that you need to specify the flag once per clippy argument.
Seems like all that's left is resolution on the fingerprint requirement and the clippy-driver error handling requirement and if any changes are needed along with final code review and approval. Lets hope the current version passes CI :) |
This is only a warning because rustup(?) already warns and is much more verbose about how to recover from the error, so I would like to call into the clippy-driver shim or w/e is outputting nice error messages. But incase rustup is not available or some other shenanigans occur, cargo will also output the warning so the error isn't a mystery.
Co-Authored-By: Eric Huss <eric@huss.org>
Co-Authored-By: Eric Huss <eric@huss.org>
Sorry for the delay in response. I've been a bit busy lately, and I'll be gone most of this week. I'll try to check in later, just beware if it takes me a while to respond. |
rustc_wrapper and primary_unit_rustc are doing different things though. In the context of a Clippy could use |
Yea, but I don't think it is necessary.
If opts.compile_opts.build_config.primary_unit_rustc = Some(wrapper); This means the dependencies will be built like in a normal build. That's all that is necessary for Making fix work with clippy then becomes a relatively simple change of something like: let rustc = if env::var(CLIPPY_FIX_ARGS).is_ok() {
util::config::clippy_driver()
} else {
args.rustc.as_ref().expect("fix wrapper rustc was not set").clone()
}; instead of encoding |
So for non primary crates we never go into the subprocess cargo and rely on the fall through path? Didn't know that was allowed and in that context everything you've been saying makes way more sense. |
Yes. I believe the current design is just an artifact of how it evolved (using the existing wrapper machinery). |
Ok I think I did everything correctly but now its failing, my quick checking didnt show anything obviously wrong.
I'll try digging into the behavior and tracing where everything is going tonight. |
Thanks!! @bors r+ |
📌 Commit 22b430d has been approved by |
initial working version of cargo fix --clippy closes #7006
☀️ Test successful - checks-travis, status-appveyor |
Update cargo 11 commits in e3563dbdcd2e370bc4f11d080f739d82d25773fd..d0f828419d6ce6be21a90866964f58eb2c07cd56 2019-07-16 19:22:44 +0000 to 2019-07-23 21:58:59 +0000 - Remove include/exclude glob warning. (rust-lang/cargo#7170) - Optimize lock file format for git merge conflicts (rust-lang/cargo#7070) - Set up CI with Azure Pipelines (rust-lang/cargo#7139) - Force clippy to run. (rust-lang/cargo#7157) - Work around #61440 (rust-lang/cargo#7158) - initial working version of cargo fix --clippy (rust-lang/cargo#7069) - Optimize runtime of `#[cargo_test_macro]` (rust-lang/cargo#7146) - Don't fail if we can't acquire readonly lock (rust-lang/cargo#7149) - Add support for multiple --features options (rust-lang/cargo#7084) - Fix a typo in an env var name (rust-lang/cargo#7145) - Add a way to disable all nightly tests (rust-lang/cargo#7142)
Would it be possible to add back |
I think a blessed position is good, these are official tools and totally could be just maintained as a single unit if we wanted to. Creating good APIs for this requires a lot of consensus building, for an area that doesn't have many users. Y'all are free to RFC for more wrapper functionality, but here we're blocked on getting important cargo fix/cargo clippy functionality out |
Sorry if my initial frustration leaked out; I really do appreciate the few people who are making everything good. I guess I'm just being idealistic when hoping for the apis to be general and extensible :) I'll make a PR real quick. Thanks! |
closes #7006