Reword suggestion message

This commit is contained in:
Esteban Küber 2024-11-16 00:22:54 +00:00
parent 629a69f3e2
commit c09c73b996
10 changed files with 23 additions and 23 deletions

View File

@ -581,7 +581,7 @@ impl<'a> Parser<'a> {
{ {
// These are more likely to have been meant as a block body. // These are more likely to have been meant as a block body.
e.multipart_suggestion( e.multipart_suggestion(
"try placing this code inside a block", "you might have meant to write this as part of a block",
vec![ vec![
(stmt_span.shrink_to_lo(), "{ ".to_string()), (stmt_span.shrink_to_lo(), "{ ".to_string()),
(stmt_span.shrink_to_hi(), " }".to_string()), (stmt_span.shrink_to_hi(), " }".to_string()),
@ -593,7 +593,7 @@ impl<'a> Parser<'a> {
(token::OpenDelim(Delimiter::Brace), _) => {} (token::OpenDelim(Delimiter::Brace), _) => {}
(_, _) => { (_, _) => {
e.multipart_suggestion( e.multipart_suggestion(
"try placing this code inside a block", "you might have meant to write this as part of a block",
vec![ vec![
(stmt_span.shrink_to_lo(), "{ ".to_string()), (stmt_span.shrink_to_lo(), "{ ".to_string()),
(stmt_span.shrink_to_hi(), " }".to_string()), (stmt_span.shrink_to_hi(), " }".to_string()),

View File

@ -4,7 +4,7 @@ error: conditional `else if` is not supported for `let...else`
LL | let Some(_) = Some(()) else if true { LL | let Some(_) = Some(()) else if true {
| ^^ expected `{` | ^^ 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 ~ let Some(_) = Some(()) else { if true {
LL | LL |

View File

@ -6,7 +6,7 @@ LL | { unsafe 92 }
| | | |
| while parsing this `unsafe` expression | 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 } } LL | { unsafe { 92 } }
| + + | + +

View File

@ -25,7 +25,7 @@ note: the `if` expression is missing a block after this condition
| |
LL | if (foo) 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; } LL | { bar; }
| + + | + +

View File

@ -29,7 +29,7 @@ note: the `if` expression is missing a block after this condition
| |
LL | if true x 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 } LL | if true { x }
| + + | + +
@ -65,7 +65,7 @@ note: the `if` expression is missing a block after this condition
| |
LL | if true x else {} 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 {} LL | if true { x } else {}
| + + | + +

View File

@ -6,7 +6,7 @@ LL | loop
LL | let x = 0; LL | let x = 0;
| ^^^ expected `{` | ^^^ 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; } LL | { let x = 0; }
| + + | + +
@ -21,7 +21,7 @@ LL | while true
LL | let x = 0; LL | let x = 0;
| ^^^ expected `{` | ^^^ 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; } LL | { let x = 0; }
| + + | + +
@ -32,7 +32,7 @@ error: expected `{`, found keyword `let`
LL | let x = 0; LL | let x = 0;
| ^^^ expected `{` | ^^^ 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; } LL | { let x = 0; }
| + + | + +

View File

@ -4,7 +4,7 @@ error: expected `{`, found `22`
LL | let x = || -> i32 22; LL | let x = || -> i32 22;
| ^^ expected `{` | ^^ 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 }; LL | let x = || -> i32 { 22 };
| + + | + +

View File

@ -30,7 +30,7 @@ error: expected `{`, found `falsy`
LL | } else falsy(); LL | } else falsy();
| ^^^^^ expected `{` | ^^^^^ 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() }; LL | } else { falsy() };
| + + | + +
@ -41,7 +41,7 @@ error: expected `{`, found keyword `loop`
LL | } else loop{} LL | } else loop{}
| ^^^^ expected `{` | ^^^^ 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{} } LL | } else { loop{} }
| + + | + +
@ -65,7 +65,7 @@ error: expected `{`, found `falsy`
LL | } else falsy!(); LL | } else falsy!();
| ^^^^^ expected `{` | ^^^^^ 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!() }; LL | } else { falsy!() };
| + + | + +
@ -89,7 +89,7 @@ error: expected `{`, found `falsy`
LL | } else falsy! {}; LL | } else falsy! {};
| ^^^^^ expected `{` | ^^^^^ 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! {} }; LL | } else { falsy! {} };
| + + | + +

View File

@ -23,7 +23,7 @@ note: the `if` expression is missing a block after this condition
| |
LL | if let () = () 'a {} 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 {} } LL | if let () = () { 'a {} }
| + + | + +
@ -53,7 +53,7 @@ note: the `if` expression is missing a block after this condition
| |
LL | if true 'a {} 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 {} } LL | if true { 'a {} }
| + + | + +
@ -80,7 +80,7 @@ LL | loop 'a {}
| | | |
| while parsing this `loop` expression | 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 {} } LL | loop { 'a {} }
| + + | + +
@ -108,7 +108,7 @@ LL | while true 'a {}
| | this `while` condition successfully parsed | | this `while` condition successfully parsed
| while parsing the body of this `while` expression | 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 {} } LL | while true { 'a {} }
| + + | + +
@ -136,7 +136,7 @@ LL | while let () = () 'a {}
| | this `while` condition successfully parsed | | this `while` condition successfully parsed
| while parsing the body of this `while` expression | 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 {} } LL | while let () = () { 'a {} }
| + + | + +
@ -161,7 +161,7 @@ error: expected `{`, found `'a`
LL | for _ in 0..0 'a {} LL | for _ in 0..0 'a {}
| ^^ expected `{` | ^^ 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 {} } LL | for _ in 0..0 { 'a {} }
| + + | + +
@ -188,7 +188,7 @@ LL | unsafe 'a {}
| | | |
| while parsing this `unsafe` expression | 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 {} } LL | unsafe { 'a {} }
| + + | + +

View File

@ -6,7 +6,7 @@ LL | unsafe //{
LL | std::mem::transmute::<f32, u32>(1.0); LL | std::mem::transmute::<f32, u32>(1.0);
| ^^^ expected `{` | ^^^ 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); } LL | { std::mem::transmute::<f32, u32>(1.0); }
| + + | + +