-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Document cargo-clippy
feature
#10229
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon. Please see the contribution instructions for more information. |
I’m not entirely satisfied with this, but I wanted to get something out. Note that the file seems to be wrapped at 120 characters instead of 80 like other book source files. I decided to match the file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would argue that this isn't the right approach. If sections should be ignored by Clippy, you can just add #[allow(clippy::all)]
. (You may have to add other lints or lint groups to that list to make it work. But for the average user clippy::all
should be enough).
I think we only still support the cargo-clippy
feature, because of backwards compat, which would also explain why it was removed from the documentation.
This is useful a few different situations that arise when working with generated code (particularly code generated by a tool you didn’t write):
Mostly I care about number 1, since that’s what I ran into. Perhaps this is a rare enough need that it’s not worth documenting. It’s possible that #10220 is enough to help somebody who has a similar problem in the future — I spent quite some time searching for a way to do this before I filed that issue. If you feel that this shouldn’t be documented, please go ahead and close. Otherwise, I’m happy to adjust the documentation, or move it somewhere else, or whatever you think is best. |
I think you convinced me that documenting this is worth it. However I think we shouldn't advertise it so prominently. I would put it at the end of the file you've put it in and add a note that this should only be needed in really special cases. You can add a note to a MD book with markdown quotes: > Text of the note goes here To properly address this, we should investigate what takes so long in Clippy and rather address the issue instead of the symptom. |
f8a74f1
to
33f3bc6
Compare
Done. I shortened the copy a little more, but I thought it was probably best to keep the example. That said, I’m happy to change this however you like. There’s more details about the underlying problem in #10220 (short version: I have a 48,000 line nested |
It is possible to use conditional compilation to prevent Clippy from evaluating certain code. This adds a brief explanation of how to use the feature with conditional compilation, and mentions that generally it’s preferable to use something like `#[allow(clippy::all)]`. Fixes rust-lang#10220 — Ability to skip files or blocks entirely
33f3bc6
to
471de0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I really like the wording now. This totally slipped through, I have way too many GH notifications...
@bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
It is possible to use conditional compilation to prevent Clippy from evaluating certain code at all. Unfortunately, it was no longer documented anywhere. This adds a brief explanation of how to use the feature with conditional compilation, and mentions a few downsides.
Fixes #10220 — Ability to skip files or blocks entirely
changelog: none