Merged
Conversation
|
r? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
* `break` and `continue` statments local to the would-be closure are allowed * don't lint in const contexts * don't lint when yield expressions are used * don't lint when the captures made by the would-be closure conflict with the other branch * don't lint when a field of a local is used when the type could be pontentially moved from * in some cases, don't lint when scrutinee expression conflicts with the captures of the would-be closure
3e28fb1 to
8b3ca9a
Compare
giraffate
reviewed
Aug 23, 2021
Contributor
giraffate
left a comment
There was a problem hiding this comment.
Sorry for the late review.
changelog: don't lint when yield expressions are used in
option_if_let_else
What kind of case is this? Is there a test for this?
Contributor
|
Additionally, it would be helpful if you split the PR or commits for each issue next time. I'm okay with that this time. |
ecda51a to
3e5dcba
Compare
Contributor
Author
|
yield expressions (used in async await) can't be moved into a closure. There is a test now. |
giraffate
approved these changes
Aug 30, 2021
Contributor
|
@bors r+ Thanks! |
Contributor
|
📌 Commit 3e5dcba has been approved by |
Contributor
Contributor
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes: #5822
fixes: #6737
fixes: #7567
The inference from #6137 still exists so I'm not sure if this should be moved from the nursery. Before doing that though I'd almost want to see this split into two lints. One suggesting
map_orand the other suggestingmap_or_else.map_or_elsetends to have longer expressions for both branches so it doesn't end up much shorter than a match expression in practice. It also seems most people find it harder to read.map_orat least has the terseness benefit of being on one line most of the time, especially when theNonebranch is just a literal or path expression.changelog:
breakandcontinuestatments local to the would-be closure are allowed inoption_if_let_elsechangelog: don't lint in const contexts in
option_if_let_elsechangelog: don't lint when yield expressions are used in
option_if_let_elsechangelog: don't lint when the captures made by the would-be closure conflict with the other branch in
option_if_let_elsechangelog: don't lint when a field of a local is used when the type could be pontentially moved from in
option_if_let_elsechangelog: in some cases, don't lint when scrutinee expression conflicts with the captures of the would-be closure in
option_if_let_else