Rewrite cargo-clippy - #17573
Conversation
|
Thanks for the pull request. A reviewer will take a look after it receives 2 community reviews. In the meantime, we would highly appreciate if you could try to review any of PRs waiting on community reviews. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
* Move all argument parsing into a single loop. * Print an error when `--explain` is missing an argument. * Print an error when there are multiple `--explain` arguments. * Don't parse flags after `--`
| // Cargo exited due to a signal | ||
| ExitCode::from(u8::MAX) |
There was a problem hiding this comment.
not https://doc.rust-lang.org/beta/std/process/struct.ExitCode.html#associatedconstant.FAILURE ?
Both versions are fine with me, just asking if intentional.
| // Cargo exited due to a signal | |
| ExitCode::from(u8::MAX) | |
| // Cargo exited due to a signal | |
| ExitCode::FAILURE |
There was a problem hiding this comment.
We already have a unique exit code for this. Is it useful; probably not.
| @@ -1,153 +1,167 @@ | |||
| // We need this feature as it changes `dylib` linking behavior and allows us to link to | |||
| // `rustc_driver`. | |||
| #![feature(rustc_private)] | |||
There was a problem hiding this comment.
I would find the dylib explaination quite usefull as it is non-obvious.. can you re-add the comment here or in below expect?
There was a problem hiding this comment.
The feature doesn't change linking behaviour. Importing rustc_driver is what links to the dylib.
Not at all necessary rewrite, but it fixes a couple of weird things.
-h,-Vand--explainare no longer parsed if they occur after the--argument. Doesn't really make a difference in practice, but this matches how other programs with argument forwarding work.--explainactually prints an error message when there's no argument.--explaingives an error when it appears multiple times instead of only printing the first. Alternatively we could just print all lints.This also doesn't walk the argument list four times. Not a big deal since the argument list is usually short and running cargo isn't exactly fast in the first place.
changelog: none