-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Extend the irrefutable_let_patterns lint to let chains #94951
Merged
Merged
Conversation
This file contains 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
rustbot
added
the
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
Mar 15, 2022
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Mar 15, 2022
This comment has been minimized.
This comment has been minimized.
est31
force-pushed
the
irrefutable_let_chain_patterns
branch
from
March 15, 2022 14:42
49b726b
to
9140779
Compare
This comment has been minimized.
This comment has been minimized.
est31
force-pushed
the
irrefutable_let_chain_patterns
branch
2 times, most recently
from
March 15, 2022 17:16
3ca8f0e
to
ce3cdd2
Compare
This comment has been minimized.
This comment has been minimized.
estebank
reviewed
Mar 15, 2022
est31
force-pushed
the
irrefutable_let_chain_patterns
branch
2 times, most recently
from
March 15, 2022 21:43
284fb1a
to
fb38040
Compare
This comment has been minimized.
This comment has been minimized.
est31
force-pushed
the
irrefutable_let_chain_patterns
branch
from
March 15, 2022 22:29
fb38040
to
a574d3a
Compare
This comment has been minimized.
This comment has been minimized.
est31
force-pushed
the
irrefutable_let_chain_patterns
branch
from
March 15, 2022 22:46
a574d3a
to
cafb407
Compare
This comment has been minimized.
This comment has been minimized.
Only look for complete suffixes or prefixes of irrefutable let patterns, so that an irrefutable let pattern in a chain surrounded by refutable ones is not linted, as it is an useful pattern.
est31
force-pushed
the
irrefutable_let_chain_patterns
branch
from
March 15, 2022 23:32
cafb407
to
0f4c81a
Compare
@bors r+ |
📌 Commit 0f4c81a has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Mar 16, 2022
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 16, 2022
Rollup of 5 pull requests Successful merges: - rust-lang#94868 (Format core and std macro rules, removing needless surrounding blocks) - rust-lang#94951 (Extend the irrefutable_let_patterns lint to let chains) - rust-lang#94955 (Refactor: Use `format_args_capture` in some parts of `rustc_parse`) - rust-lang#94957 (Improve the explanation about the behaviour of read_line) - rust-lang#94974 (Ensure that `let_else` does not interact with `let_chains`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Thanks @est31 |
This was referenced Aug 22, 2022
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Implements the suggestion from #94927 (comment)
We only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern that has no low-cost replacement (unlike suffixes or prefixes which can just be moved outside of the
if
: either into theif
's block, or the block surrounding theif
).If all patterns in a let chain are irrefutable, we lint as well.
Depends on #94958
so I included it into the PR for nowwhich has been merged since.r? @estebank
cc @joshtriplett @c410-f3r