Skip to content

Commit d3e4dd2

Browse files
committed
Use let...else consistently in user-facing diagnostics
1 parent c23ed3e commit d3e4dd2

21 files changed

+25
-25
lines changed

compiler/rustc_hir_analysis/src/check/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn resolve_block<'tcx>(
9999
for (i, statement) in blk.stmts.iter().enumerate() {
100100
match statement.kind {
101101
hir::StmtKind::Let(LetStmt { els: Some(els), .. }) => {
102-
// Let-else has a special lexical structure for variables.
102+
// let-else has a special lexical structure for variables.
103103
// First we take a checkpoint of the current scope context here.
104104
let mut prev_cx = visitor.cx;
105105

compiler/rustc_mir_build/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ mir_build_suggest_if_let = you might want to use `if let` to ignore the {$count
334334
*[other] variants that aren't
335335
} matched
336336
337-
mir_build_suggest_let_else = you might want to use `let else` to handle the {$count ->
337+
mir_build_suggest_let_else = you might want to use `let...else` to handle the {$count ->
338338
[one] variant that isn't
339339
*[other] variants that aren't
340340
} matched

compiler/rustc_parse/src/parser/stmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ impl<'a> Parser<'a> {
867867
if let_else || !if_let {
868868
err.span_suggestion_verbose(
869869
block_span.shrink_to_lo(),
870-
format!("{alternatively}you might have meant to use `let else`"),
870+
format!("{alternatively}you might have meant to use `let...else`"),
871871
"else ".to_string(),
872872
if let_else {
873873
Applicability::MachineApplicable

tests/ui/empty/empty-never-array.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | enum Helper<T, U> {
1414
LL | T(T, [!; 0]),
1515
| - not covered
1616
= note: the matched value is of type `Helper<T, U>`
17-
help: you might want to use `let else` to handle the variant that isn't matched
17+
help: you might want to use `let...else` to handle the variant that isn't matched
1818
|
1919
LL | let Helper::U(u) = Helper::T(t, []) else { todo!() };
2020
| ++++++++++++++++

tests/ui/error-codes/E0005.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | let Some(y) = x;
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
88
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `Option<i32>`
10-
help: you might want to use `let else` to handle the variant that isn't matched
10+
help: you might want to use `let...else` to handle the variant that isn't matched
1111
|
1212
LL | let Some(y) = x else { todo!() };
1313
| ++++++++++++++++

tests/ui/feature-gates/feature-gate-exhaustive-patterns.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | let Ok(_x) = &foo();
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
88
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
99
= note: the matched value is of type `&Result<u32, !>`
10-
help: you might want to use `let else` to handle the variant that isn't matched
10+
help: you might want to use `let...else` to handle the variant that isn't matched
1111
|
1212
LL | let Ok(_x) = &foo() else { todo!() };
1313
| ++++++++++++++++

tests/ui/half-open-range-patterns/feature-gate-half-open-range-patterns-in-slices.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs;
1717
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
1818
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
1919
= note: the matched value is of type `[i32; 8]`
20-
help: you might want to use `let else` to handle the variant that isn't matched
20+
help: you might want to use `let...else` to handle the variant that isn't matched
2121
|
2222
LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs else { todo!() };
2323
| ++++++++++++++++

tests/ui/half-open-range-patterns/slice_pattern_syntax_problem1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs;
1717
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
1818
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
1919
= note: the matched value is of type `[i32; 8]`
20-
help: you might want to use `let else` to handle the variant that isn't matched
20+
help: you might want to use `let...else` to handle the variant that isn't matched
2121
|
2222
LL | let [a @ 3.., b @ ..3, c @ 4..6, ..] = xs else { todo!() };
2323
| ++++++++++++++++

tests/ui/pattern/issue-106552.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LL | let x @ 5 = 6;
2525
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
2626
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
2727
= note: the matched value is of type `i32`
28-
help: you might want to use `let else` to handle the variants that aren't matched
28+
help: you might want to use `let...else` to handle the variants that aren't matched
2929
|
3030
LL | let x @ 5 = 6 else { todo!() };
3131
| ++++++++++++++++

tests/ui/pattern/usefulness/empty-types.exhaustive_patterns.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ LL | let Ok(_x) = res_u32_never.as_ref();
152152
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
153153
= note: for more information, visit https://doc.rust-lang.org/book/ch19-02-refutability.html
154154
= note: the matched value is of type `Result<&u32, &!>`
155-
help: you might want to use `let else` to handle the variant that isn't matched
155+
help: you might want to use `let...else` to handle the variant that isn't matched
156156
|
157157
LL | let Ok(_x) = res_u32_never.as_ref() else { todo!() };
158158
| ++++++++++++++++

0 commit comments

Comments
 (0)