Improve irrefutable let-else lint wording#153048
Improve irrefutable let-else lint wording#153048rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
r? @davidtwco rustbot has assigned @davidtwco. Use Why was this reviewer chosen?The reviewer was selected based on:
|
1af1bc9 to
8f4b39f
Compare
|
Some changes occurred in match checking cc @Nadrieril |
8f4b39f to
92c4925
Compare
| *[other] these patterns | ||
| } will always match, so the `else` clause is useless" | ||
| } will always succeed, so the `else` clause is unreachable" | ||
| )] |
There was a problem hiding this comment.
Can we turn this into a span_label pointing at the pattern (in most cases, a binding)? It might even make sense to detect when it is an identifier binding to explain in a note that all let bindings are patterns.
There was a problem hiding this comment.
Thanks, good idea. Right now the primary span already points at the pattern, and I tried to keep the wording generic to avoid extra logic. I would prefer to keep this pr small, I can follow up separately if we want to explore a span label binding specific note.
|
I don't think that creating a new field just for this is reasonable, I think it would make more much sense to pass |
92c4925 to
eba9297
Compare
This comment has been minimized.
This comment has been minimized.
Thanks, that makes sense. I will switch this to pass else_span through as an argument instead of storing it on MatchVisitor. |
eba9297 to
db88aa2
Compare
|
Reminder, once the PR becomes ready for a review, use |
db88aa2 to
906e74b
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
906e74b to
a8d4eee
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r+ rollup |
Rollup of 8 pull requests Successful merges: - #153280 (Add regression test for `doc(fake_variadic)` on reexports) - #153302 (x86: reserve `bl` and `bh` registers to match `rbx`) - #153358 (Boundary tests for various Duration-float operations) - #153048 (Improve irrefutable let-else lint wording) - #153258 (diag: Suppress `.clone()` suggestion inside derive macro expansions) - #153272 (Add `Path::absolute` method as alias for `std::path::absolute`) - #153295 (update panicking() docs for panic=abort) - #153352 (Migration of `LintDiagnostic` - part 6)
Update the
irrefutable_let_patternswording for let-else to better reflect that theelseclause is unreachable when the LHS pattern always matches.Closes #152938