Add spaces before and after expr in add {} suggestion
Co-authored-by: Michael Goulet <michael@errs.io>
This commit is contained in:
parent
f06f051745
commit
4f85a73e51
3 changed files with 14 additions and 14 deletions
|
@ -1593,8 +1593,8 @@ impl<'a> Parser<'a> {
|
|||
|
||||
let sugg_msg = "consider enclosing expression in a block";
|
||||
let suggestions = vec![
|
||||
(span.shrink_to_lo(), "{".to_owned()),
|
||||
(span.shrink_to_hi(), "}".to_owned()),
|
||||
(span.shrink_to_lo(), "{ ".to_owned()),
|
||||
(span.shrink_to_hi(), " }".to_owned()),
|
||||
];
|
||||
|
||||
err.multipart_suggestion_verbose(
|
||||
|
|
|
@ -4,12 +4,12 @@ fn main() {
|
|||
let _ = 1 + 1; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
|
||||
match () { () => {}, }; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
'label: {match () { () => break 'label, }}; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
'label: { match () { () => break 'label, } }; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
#[allow(unused_labels)]
|
||||
'label: {match () { () => 'lp: loop { break 'lp 0 }, }}; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
'label: { match () { () => 'lp: loop { break 'lp 0 }, } }; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
|
||||
let x = 1;
|
||||
let _i = 'label: {match x { //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
let _i = 'label: { match x { //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
0 => 42,
|
||||
1 if false => break 'label 17,
|
||||
1 => {
|
||||
|
@ -20,8 +20,8 @@ fn main() {
|
|||
}
|
||||
}
|
||||
_ => 1,
|
||||
}};
|
||||
} };
|
||||
|
||||
let other = 3;
|
||||
let _val = 'label: {(1, if other == 3 { break 'label (2, 3) } else { other })}; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
let _val = 'label: { (1, if other == 3 { break 'label (2, 3) } else { other }) }; //~ ERROR expected `while`, `for`, `loop` or `{` after a label
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ LL | 'label: match () { () => break 'label, };
|
|||
|
|
||||
help: consider enclosing expression in a block
|
||||
|
|
||||
LL | 'label: {match () { () => break 'label, }};
|
||||
LL | 'label: { match () { () => break 'label, } };
|
||||
| + +
|
||||
|
||||
error: expected `while`, `for`, `loop` or `{` after a label
|
||||
|
@ -41,7 +41,7 @@ LL | 'label: match () { () => 'lp: loop { break 'lp 0 }, };
|
|||
|
|
||||
help: consider enclosing expression in a block
|
||||
|
|
||||
LL | 'label: {match () { () => 'lp: loop { break 'lp 0 }, }};
|
||||
LL | 'label: { match () { () => 'lp: loop { break 'lp 0 }, } };
|
||||
| + +
|
||||
|
||||
error: expected `while`, `for`, `loop` or `{` after a label
|
||||
|
@ -52,7 +52,7 @@ LL | let _i = 'label: match x {
|
|||
|
|
||||
help: consider enclosing expression in a block
|
||||
|
|
||||
LL ~ let _i = 'label: {match x {
|
||||
LL ~ let _i = 'label: { match x {
|
||||
LL | 0 => 42,
|
||||
LL | 1 if false => break 'label 17,
|
||||
LL | 1 => {
|
||||
|
@ -68,7 +68,7 @@ LL | let _val = 'label: (1, if other == 3 { break 'label (2, 3) } else { oth
|
|||
|
|
||||
help: consider enclosing expression in a block
|
||||
|
|
||||
LL | let _val = 'label: {(1, if other == 3 { break 'label (2, 3) } else { other })};
|
||||
LL | let _val = 'label: { (1, if other == 3 { break 'label (2, 3) } else { other }) };
|
||||
| + +
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue