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
new lint: manual_while_let_some
#10647
Conversation
r? @llogiq (rustbot has picked a reviewer for you, use r? to override) |
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 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
]