@@ -211,30 +211,6 @@ pub(crate) fn fixup_syntax(node: &SyntaxNode) -> SyntaxFixups {
211
211
if it. match_arm_list( ) . is_none( ) {
212
212
// No match arms
213
213
append. insert( node. clone( ) . into( ) , vec![
214
- SyntheticToken {
215
- kind: SyntaxKind :: L_CURLY ,
216
- text: "{" . into( ) ,
217
- range: end_range,
218
- id: EMPTY_ID ,
219
- } ,
220
- SyntheticToken {
221
- kind: SyntaxKind :: UNDERSCORE ,
222
- text: "_" . into( ) ,
223
- range: end_range,
224
- id: EMPTY_ID
225
- } ,
226
- SyntheticToken {
227
- kind: SyntaxKind :: EQ ,
228
- text: "=" . into( ) ,
229
- range: end_range,
230
- id: EMPTY_ID
231
- } ,
232
- SyntheticToken {
233
- kind: SyntaxKind :: R_ANGLE ,
234
- text: ">" . into( ) ,
235
- range: end_range,
236
- id: EMPTY_ID
237
- } ,
238
214
SyntheticToken {
239
215
kind: SyntaxKind :: L_CURLY ,
240
216
text: "{" . into( ) ,
@@ -247,12 +223,6 @@ pub(crate) fn fixup_syntax(node: &SyntaxNode) -> SyntaxFixups {
247
223
range: end_range,
248
224
id: EMPTY_ID ,
249
225
} ,
250
- SyntheticToken {
251
- kind: SyntaxKind :: R_CURLY ,
252
- text: "}" . into( ) ,
253
- range: end_range,
254
- id: EMPTY_ID ,
255
- } ,
256
226
] ) ;
257
227
}
258
228
} ,
@@ -270,11 +240,12 @@ pub(crate) fn fixup_syntax(node: &SyntaxNode) -> SyntaxFixups {
270
240
271
241
if it. pat( ) . is_none( ) && it. in_token( ) . is_none( ) && it. iterable( ) . is_none( ) {
272
242
append. insert( for_token. into( ) , vec![ pat, in_token, iter] ) ;
243
+ } else if it. pat( ) . is_none( ) {
244
+ append. insert( for_token. into( ) , vec![ pat] ) ;
245
+ } else if it. pat( ) . is_none( ) && it. in_token( ) . is_none( ) {
246
+ append. insert( for_token. into( ) , vec![ pat, in_token] ) ;
273
247
}
274
248
275
- // Tricky: add logic to add in just a pattern or iterable if not all
276
- // the pieces are missing
277
-
278
249
if it. loop_body( ) . is_none( ) {
279
250
append. insert( node. clone( ) . into( ) , vec![
280
251
SyntheticToken {
@@ -398,6 +369,18 @@ fn foo () {for _ in __ra_fixup {}}
398
369
)
399
370
}
400
371
372
+ fn for_no_iter_no_in ( ) {
373
+ check (
374
+ r#"
375
+ fn foo() {
376
+ for _ {}
377
+ }
378
+ "# ,
379
+ expect ! [ [ r#"
380
+ fn foo () {for _ in __ra_fixup {}}
381
+ "# ] ] ,
382
+ )
383
+ }
401
384
#[ test]
402
385
fn for_no_iter ( ) {
403
386
check (
@@ -435,7 +418,7 @@ fn foo() {
435
418
}
436
419
"# ,
437
420
expect ! [ [ r#"
438
- fn foo () {match __ra_fixup {_ => {} }}
421
+ fn foo () {match __ra_fixup {}}
439
422
"# ] ] ,
440
423
)
441
424
}
@@ -467,7 +450,7 @@ fn foo() {
467
450
}
468
451
"# ,
469
452
expect ! [ [ r#"
470
- fn foo () {match __ra_fixup {_ => {} }}
453
+ fn foo () {match __ra_fixup {}}
471
454
"# ] ] ,
472
455
)
473
456
}
0 commit comments