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.
|
☔ The latest upstream changes (possibly #17632) made this pull request unmergeable. Please resolve the merge conflicts. |
`cargo clippy --explain <lint>` prints `unknown lint` for every lint on beta and nightly. `src/main.rs` lowercases the argument, but `Lint::name` is uppercase (`clippy::ALLOW_ATTRIBUTES`), so the lookup in `explain` never matches. The `to_ascii_uppercase` that reconciled the two was dropped in c97f7eb ("Rewrite of the config parsing code"), and this restores that line verbatim. `beta` and `master` carry the commit, stable 0.1.98 does not, which is why `--explain` still works there. The lowercase rebinding below the lookup is deliberately left alone. `mdconf.retain(...)` keys on that form, so removing it would silently drop every configuration section. The tests are new because `--explain` had no coverage at all, which is how this went unreported for three weeks. `cargo test --features internal` passes here apart from the 16 `tests/ui-internal` cases, which fail the same way on an unmodified master checkout, so they look local to my Windows setup. rust-lang#17573 moves this code and inherits the same mismatch, so whichever lands second needs a small rebase. fixes rust-lang#17620 changelog: Fix `cargo clippy --explain <lint>` reporting `unknown lint` for every lint
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