new lint: manual_while_let_some#10647
Conversation
|
r? @llogiq (rustbot has picked a reviewer for you, use r? to override) |
llogiq
left a comment
There was a problem hiding this comment.
This is a good starting point! 👍
For a style lint, I'd like to have a real working suggestion. Otherwise I'd be fine with putting the lint in nursery for the time being, and work on it in follow-up PRs. Otherwise a few more tests would be great.
|
I like it! 👍 The only thing I think we might improve is the name. |
|
I agree, |
|
Thank you! @bors r+ |
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
This PR implements the lint I suggested on zulip.
It looks for while loops like these:
and suggests replacing it with a while-let loop, like this:
... which is more concise and idiomatic.
It only looks for
Vec::pop()calls in the first statement of the loop body in an attempt to not trigger FPs (as pop might only be called conditionally).changelog: new lint [
manual_while_let_some]