File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -175,8 +175,26 @@ pub(crate) fn fixup_syntax(node: &SyntaxNode) -> SyntaxFixups {
175
175
] ) ;
176
176
}
177
177
} ,
178
+ ast:: LoopExpr ( it) => {
179
+ if it. loop_body( ) . is_none( ) {
180
+ append. insert( node. clone( ) . into( ) , vec![
181
+ SyntheticToken {
182
+ kind: SyntaxKind :: L_CURLY ,
183
+ text: "{" . into( ) ,
184
+ range: end_range,
185
+ id: EMPTY_ID ,
186
+ } ,
187
+ SyntheticToken {
188
+ kind: SyntaxKind :: R_CURLY ,
189
+ text: "}" . into( ) ,
190
+ range: end_range,
191
+ id: EMPTY_ID ,
192
+ } ,
193
+ ] ) ;
194
+ }
195
+ } ,
178
196
// FIXME: foo::
179
- // FIXME: for, loop, match etc.
197
+ // FIXME: for, match etc.
180
198
_ => ( ) ,
181
199
}
182
200
}
@@ -450,6 +468,20 @@ fn foo() {
450
468
"# ,
451
469
expect ! [ [ r#"
452
470
fn foo () {while __ra_fixup {}}
471
+ "# ] ] ,
472
+ )
473
+ }
474
+
475
+ #[ test]
476
+ fn fixup_loop ( ) {
477
+ check (
478
+ r#"
479
+ fn foo() {
480
+ loop
481
+ }
482
+ "# ,
483
+ expect ! [ [ r#"
484
+ fn foo () {loop {}}
453
485
"# ] ] ,
454
486
)
455
487
}
You can’t perform that action at this time.
0 commit comments