Closed posborne closed 8 years ago
Interesting, this works... The fix then is easy, but I'm a bit baffled by why cargo check
works then...
$ cargo-clippy ignored --lib
...
I should add...
$ cargo --version
cargo 0.11.0-nightly (867627c 2016-04-21)
Note the CI failure in #22, cargo seems to invoke subcommands using cargo-clippy clippy ARG1 ARG2 etc
. argv[0]
would be the binary name/path, argv[1]
would be clippy
... So it does skip(2)
.
cargo clippy --lib
works fine here on cargo 0.11.0-nightly (31e7d5a 2016-04-17)
. And considering the CI failed on cargo 0.11.0-nightly (867627c 2016-04-21)
that still seems to be the case... Does it somehow depend on the OS? I'm on x86_64 Linux.
For the record, I think this behaviour is very silly and wrong... It doesn't make sense to pass the subcommand as the first argument, and git subcommand
doesn't behave like that... It might be a cargo bug then?
Yeah, something is weird on my machine I guess. I am on x86_64 and apparently using the same version of cargo as CI. I am using the the new rustup (https://github.com/rust-lang-nursery/rustup.rs) and wondering if that could somehow impact things. It is odd that things work with cargo check
which has very similar logic.
Looking at cargo, It does appear that the args passed to the subcommand would include the name of the subcommand (agreed that this behavior seems less than ideal but it would cause problems to change as well).
CC @alexcrichton
Yeah that was proposed in https://github.com/rust-lang/cargo/pull/2220 but it's unfortunately backwards incompatible at this point.
Ok, so the issue appears to be with the version of clippy currently on crates.io. I'll update the PR to just have the unit test additions.
This bug then becomes the following:
Here's a couple of projects with this form:
When trying to run, I get the following:
With cargo-check, I am able to pass the appropriate flag to the compiler to point it at a specific binary or the library as follows, but this does not seem to work for
cargo-clippy
: