-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Clarify let_underscore
documentation
#10908
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
Clarify let_underscore
documentation
#10908
Conversation
r? @llogiq (rustbot has picked a reviewer for you, use r? to override) |
clippy_lints/src/let_underscore.rs
Outdated
@@ -122,7 +122,7 @@ declare_clippy_lint! { | |||
/// } | |||
/// // Either provide a type annotation: | |||
/// let _: Result<u32, ()> = foo(); | |||
/// // …or drop the let keyword: | |||
/// // …or drop the `let` keyword to fully ignore the type no matter what: |
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.
The assign-to-underscore pattern doesn't so much ignore the type as the binding. That said, I'm unsure how to best formulate this.
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 used this phrasing because the original PR did it.
#10356
[...] Alternatively, they can drop the let keyword to truly just ignore the value no matter what.
I made the original ticket. I'm still unsure about why we'd warn that The only difference that I know of is that you can say |
It's not preferred. |
AFAIK, both I'm not sure it should have been implemented in the lint in the first place, but now that's here, I also don't see a reason to remove it. It's less verbose than an |
If we could add a line like "to allow this anyway, use _ = ..." then it'd be clearer. It's just that it currently sounds like a solution to the lroblem rather than a way to disable the hint and ignore it. |
167840e
to
9199fed
Compare
@Fuuzetsu what do you think about the new commit? This has been in the middle of my notifications for 3 weeks now, I think it's ready 😅 |
Looks better to me. I suppose there are other ways of saying the same thing such as |
@llogiq What do you think about the current phrasing? |
I think it is very unintuitive that |
I'll just close this, 107 days for 4 words of documentation is kinda ridiculous. |
Fixes #10867
changelog: [
let_underscore
]: Clarify its documentation