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

Clippy's CLI usage error screen shows cargo check #5640

Open
camelid opened this issue May 24, 2020 · 6 comments
Open

Clippy's CLI usage error screen shows cargo check #5640

camelid opened this issue May 24, 2020 · 6 comments
Labels
C-bug Category: Clippy is not doing the correct thing T-cargo Type: cargo related

Comments

@camelid
Copy link
Member

camelid commented May 24, 2020

Clippy's CLI usage error screen shows cargo check instead of cargo clippy:

error: Found argument 'src/librustc_driver/lib.rs' which wasn't expected, or isn't valid in this context

USAGE:
    cargo check [OPTIONS]

For more information try --help

I would expect it to say:

error: Found argument 'src/librustc_driver/lib.rs' which wasn't expected, or isn't valid in this context

USAGE:
    cargo clippy [OPTIONS]

For more information try --help

Output of cargo clippy -V:

clippy 0.0.212 (204bb9b5 2020-03-17)
@phansch phansch added the C-bug Category: Clippy is not doing the correct thing label May 24, 2020
@phansch
Copy link
Member

phansch commented May 24, 2020

Thanks for the report! What command were you running that caused this error?

@phansch phansch added the T-cargo Type: cargo related label May 24, 2020
@camelid
Copy link
Member Author

camelid commented May 24, 2020

cargo clippy src/librustc_driver/lib.rs

I was testing to see if I could run clippy on a single file. Is there a way to do that so that it filters out all warnings etc. from other files?

@matthiaskrgr
Copy link
Member

matthiaskrgr commented May 24, 2020

cargo clippy executes cargo in a crate (similar to cargo check).
I think you want clippy-driver path/to/file.rs.

EDIT: you can allow/deny warnings like so: clippy-driver file.rs -Wclippy::lintname -Dclippy:otherlintname

@camelid
Copy link
Member Author

camelid commented May 24, 2020

Sorry, perhaps I wasn't clear enough! I meant that I wanted it to work like cargo clippy so that it imports other items in my crate, but instead only shows the errors that stem from a particular file so that I can clearly see just the issues in that file.

If I run clippy-driver path/to/file.rs, then it gives me errors since it doesn't know about the rest of my code.

@matthiaskrgr
Copy link
Member

I don't know of an way to only show warnings of a single file while importing everything, except for allowing warnings in all other files via https://github.com/rust-lang/rust-clippy#allowingdenying-lints :/

@camelid
Copy link
Member Author

camelid commented May 24, 2020

Huh. Seems like a useful feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing T-cargo Type: cargo related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants