-
Notifications
You must be signed in to change notification settings - Fork 1.8k
NEEDLESS_OPTION_TAKE
doc improvements
#9022
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
NEEDLESS_OPTION_TAKE
doc improvements
#9022
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Jarcho (or someone else) soon. Please see the contribution instructions for more information. |
Can you expand on why calling |
@Jarcho added more details. |
Usually the Your explanation is also missing why |
@Jarcho Thanks for review! |
Between the example code and the type listing of every expression there's a lot of extra detail in the explanation. Only two points are required for understanding why
Anything not related to those two points ends up as a distraction from them. As an example, the last line along with steps three and four are the only parts needed to point out they return the same value. The rest of it ends up getting in the way of seeing what the main point is. |
clippy_lints/src/methods/mod.rs
Outdated
/// ### Why is this bad? | ||
/// Redundant code. | ||
/// ```ignore | ||
/// let x = Some(2); | ||
/// let y = x.as_ref().take(); | ||
/// ``` |
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.
This section should conceptually explain why this is bad, rather than with examples. If the examples are not good enough, please add better examples in the Examples
section. But I would prefer to keep this section free of code examples for all lints (there are always exceptions of course).
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.
@flip1995 updated
1b80081
to
340e5fb
Compare
@Jarcho updated |
That is an improvement with the extra focus. This can be further simplified to just the last sentence. It's enough to just state that the results are the same without walking through the types involved. You need to add something about |
NEEDLESS_OPTION_TAKE doc improvements NEEDLESS_OPTION_TAKE doc improvements NEEDLESS_OPTION_TAKE doc improvements NEEDLESS_OPTION_TAKE doc improvements NEEDLESS_OPTION_TAKE doc improvements NEEDLESS_OPTION_TAKE doc improvements NEEDLESS_OPTION_TAKE doc improvements
9181c5b
to
e780435
Compare
@Jarcho ok |
Looks good. Thank you for catching the missing docs. @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
changelog: More info on
NEEDLESS_OPTION_TAKE