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

Better help support in clippy-driver #4173

Closed
2 tasks
Manishearth opened this issue Jun 4, 2019 · 4 comments
Closed
2 tasks

Better help support in clippy-driver #4173

Manishearth opened this issue Jun 4, 2019 · 4 comments

Comments

@Manishearth
Copy link
Member

Manishearth commented Jun 4, 2019

Depends on #4172

It should be possible to:

  • Call clippy-driver --help to get Clippy help. Include lint groups, but not lints
  • Call clippy-driver -W help to get a lint list.

cc @yaahallo

bors added a commit that referenced this issue Jun 13, 2019
Implement better help for clippy-driver

#4173
@Manishearth
Copy link
Member Author

#4175

@phansch
Copy link
Member

phansch commented Aug 14, 2019

@yaahc I didn't follow this too closely, but shouldn't the new help be available in the Clippy component with Rust 1.37? At least the Clippy PR is included in the Clippy for Rust 1.37, but it doesn't seem to work:

$ RUSTUP_DIST_SERVER=https://dev-static.rust-lang.org rustup override set 1.37.0
$ cargo +1.37.0 clippy -V
$ cargo +1.37.0 clippy -- -W help
<snip>
error: the option `Z` is only accepted on the nightly compiler

Is there more cargo work that needs to hit stable first?

@yaahc
Copy link
Member

yaahc commented Aug 14, 2019

@phansch

rust-lang/cargo#7162 didn't make the cut and is kinda important but it shouldn't play a factor in cargo clippy, I would not expect it to work if you tried doing this via cargo clippy-preview -- -W help because that only works on nightly and the above PR, which didn't make it into this release, fixed an issue where clippy-preview wouldnt pass args to clippy-driver.

So to answer your question, yes the new help should be available, no, more work shouldn't need to land to get the additional help out of clippy-driver. And for what its worth the commands you posted work for me, though if I get the help through cargo instead of directly from clippy-driver it renders the lint groups differently, wrong in the cargo case, and now I'm wondering if thats a bug. cc @Manishearth

@yaahc
Copy link
Member

yaahc commented Aug 14, 2019

Aah, okay, the reason the output is different is because clippy-driver renders the help differently depending on if its in wrapper mode or not. cargo clippy-preview calls clippy-driver directly as if it were rustc. cargo clippy calls clippy-driver as if it were a wrapper around rustc. I don't know precisely why it outputs the way it does in non-wrapper mode or if my changes affected it, it outputs the full rustc and clippy lint lists and scopes every item in the clippy lint groups with clippy::lint_name so the output is much longer and noisier. /shrug

The best option for getting the clippy lint lists is to call clippy-driver directly, just clippy-driver -W help. This will work on stable and keep the output clean. In the future once cargo clippy-preview becomes THE cargo clippy it will be the correct interface, maybe... it behaves weird if you try to compile a crate from clean with -W help because I think it assumes those jobs are successful builds, since it prints the help and exits with a 0 status. So cargo tries to build the next crate as if its dependency had been built successfully and then it blows up because it skipped that previous compilation step. Not sure how to handle that appropriately, but I assume its something we will address prior to releasing cargo clippy-preview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants