Skip to content

Commit

Permalink
Reword suggestion message
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Nov 16, 2024
1 parent 629a69f commit c09c73b
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ impl<'a> Parser<'a> {
{
// These are more likely to have been meant as a block body.
e.multipart_suggestion(
"try placing this code inside a block",
"you might have meant to write this as part of a block",
vec![
(stmt_span.shrink_to_lo(), "{ ".to_string()),
(stmt_span.shrink_to_hi(), " }".to_string()),
Expand All @@ -593,7 +593,7 @@ impl<'a> Parser<'a> {
(token::OpenDelim(Delimiter::Brace), _) => {}
(_, _) => {
e.multipart_suggestion(
"try placing this code inside a block",
"you might have meant to write this as part of a block",
vec![
(stmt_span.shrink_to_lo(), "{ ".to_string()),
(stmt_span.shrink_to_hi(), " }".to_string()),
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/let-else/let-else-if.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: conditional `else if` is not supported for `let...else`
LL | let Some(_) = Some(()) else if true {
| ^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL ~ let Some(_) = Some(()) else { if true {
LL |
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lint/issue-104392.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | { unsafe 92 }
| |
| while parsing this `unsafe` expression
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | { unsafe { 92 } }
| + +
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/missing/missing-block-hint.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ note: the `if` expression is missing a block after this condition
|
LL | if (foo)
| ^^^^^
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | { bar; }
| + +
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/parser/bad-if-statements.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ note: the `if` expression is missing a block after this condition
|
LL | if true x
| ^^^^
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | if true { x }
| + +
Expand Down Expand Up @@ -65,7 +65,7 @@ note: the `if` expression is missing a block after this condition
|
LL | if true x else {}
| ^^^^
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | if true { x } else {}
| + +
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/parser/block-no-opening-brace.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | loop
LL | let x = 0;
| ^^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | { let x = 0; }
| + +
Expand All @@ -21,7 +21,7 @@ LL | while true
LL | let x = 0;
| ^^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | { let x = 0; }
| + +
Expand All @@ -32,7 +32,7 @@ error: expected `{`, found keyword `let`
LL | let x = 0;
| ^^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | { let x = 0; }
| + +
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/parser/closure-return-syntax.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: expected `{`, found `22`
LL | let x = || -> i32 22;
| ^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | let x = || -> i32 { 22 };
| + +
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/parser/else-no-if.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ error: expected `{`, found `falsy`
LL | } else falsy();
| ^^^^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | } else { falsy() };
| + +
Expand All @@ -41,7 +41,7 @@ error: expected `{`, found keyword `loop`
LL | } else loop{}
| ^^^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | } else { loop{} }
| + +
Expand All @@ -65,7 +65,7 @@ error: expected `{`, found `falsy`
LL | } else falsy!();
| ^^^^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | } else { falsy!() };
| + +
Expand All @@ -89,7 +89,7 @@ error: expected `{`, found `falsy`
LL | } else falsy! {};
| ^^^^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | } else { falsy! {} };
| + +
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/parser/label-after-block-like.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ note: the `if` expression is missing a block after this condition
|
LL | if let () = () 'a {}
| ^^^^^^^^^^^
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | if let () = () { 'a {} }
| + +
Expand Down Expand Up @@ -53,7 +53,7 @@ note: the `if` expression is missing a block after this condition
|
LL | if true 'a {}
| ^^^^
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | if true { 'a {} }
| + +
Expand All @@ -80,7 +80,7 @@ LL | loop 'a {}
| |
| while parsing this `loop` expression
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | loop { 'a {} }
| + +
Expand Down Expand Up @@ -108,7 +108,7 @@ LL | while true 'a {}
| | this `while` condition successfully parsed
| while parsing the body of this `while` expression
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | while true { 'a {} }
| + +
Expand Down Expand Up @@ -136,7 +136,7 @@ LL | while let () = () 'a {}
| | this `while` condition successfully parsed
| while parsing the body of this `while` expression
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | while let () = () { 'a {} }
| + +
Expand All @@ -161,7 +161,7 @@ error: expected `{`, found `'a`
LL | for _ in 0..0 'a {}
| ^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | for _ in 0..0 { 'a {} }
| + +
Expand All @@ -188,7 +188,7 @@ LL | unsafe 'a {}
| |
| while parsing this `unsafe` expression
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | unsafe { 'a {} }
| + +
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/unsafe/unsafe-block-without-braces.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LL | unsafe //{
LL | std::mem::transmute::<f32, u32>(1.0);
| ^^^ expected `{`
|
help: try placing this code inside a block
help: you might have meant to write this as part of a block
|
LL | { std::mem::transmute::<f32, u32>(1.0); }
| + +
Expand Down

0 comments on commit c09c73b

Please sign in to comment.