-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
enhancement to if_let_some_result: apply to while loops as well #7594
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
Comments
camsteffen
added
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
and removed
A-lint
Area: New lints
labels
Aug 23, 2021
@rustbot claim |
bors
added a commit
that referenced
this issue
Sep 28, 2021
…ishearth #7594: Adding new 'while_let_some_result' linting Excited for the opportunity to contribute to Clippy! Since the latest Bay Area Rust Meetup, I've been looking for an opportunity and found it 😄 Please let me know how I can improve this PR! Much of it is similar to ``[`if_let_some_result`]``, but I followed the description in the issue to create its own linting rules. Looking forward to feedback, and continuing to work on Clippy in the future! changelog: - Renamed Lint: `if_let_some_result` is now called [`match_result_ok`]. Now also handles `while let` case.
bors
added a commit
that referenced
this issue
Sep 28, 2021
…ishearth #7594: Adding new 'while_let_some_result' linting Excited for the opportunity to contribute to Clippy! Since the latest Bay Area Rust Meetup, I've been looking for an opportunity and found it 😄 Please let me know how I can improve this PR! Much of it is similar to ``[`if_let_some_result`]``, but I followed the description in the issue to create its own linting rules. Looking forward to feedback, and continuing to work on Clippy in the future! changelog: Renamed Lint: `if_let_some_result` is now called [`match_result_ok`]. Now also handles `while let` case.
bors
added a commit
that referenced
this issue
Sep 28, 2021
…ishearth #7594: Adding new 'while_let_some_result' linting Excited for the opportunity to contribute to Clippy! Since the latest Bay Area Rust Meetup, I've been looking for an opportunity and found it 😄 Please let me know how I can improve this PR! Much of it is similar to ``[`if_let_some_result`]``, but I followed the description in the issue to create its own linting rules. Looking forward to feedback, and continuing to work on Clippy in the future! changelog: Renamed Lint: `if_let_some_result` is now called [`match_result_ok`]. Now also handles `while let` case.
Done in #7608 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
What it does
Where
res
is aResult
,should be rewritten as
This could either be an enhancement to
if_let_some_result
or have a new name likewhile_let_some_result
.SEE ALSO: #7586 where previously clippy suggested an incorrect fix (changing while to if). In that thread, @camsteffen suggested creating a new issue for this.
Categories (optional)
style
What is the advantage of the recommended code over the original code
Conciseness etc.
It maintains consistency with the existent
if_let_some_result
and has the same advantages, except now for while loops too.Drawbacks
None.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: