@@ -211,30 +211,6 @@ pub(crate) fn fixup_syntax(node: &SyntaxNode) -> SyntaxFixups {
211211 if it. match_arm_list( ) . is_none( ) {
212212 // No match arms
213213 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- } ,
238214 SyntheticToken {
239215 kind: SyntaxKind :: L_CURLY ,
240216 text: "{" . into( ) ,
@@ -247,12 +223,6 @@ pub(crate) fn fixup_syntax(node: &SyntaxNode) -> SyntaxFixups {
247223 range: end_range,
248224 id: EMPTY_ID ,
249225 } ,
250- SyntheticToken {
251- kind: SyntaxKind :: R_CURLY ,
252- text: "}" . into( ) ,
253- range: end_range,
254- id: EMPTY_ID ,
255- } ,
256226 ] ) ;
257227 }
258228 } ,
@@ -270,11 +240,12 @@ pub(crate) fn fixup_syntax(node: &SyntaxNode) -> SyntaxFixups {
270240
271241 if it. pat( ) . is_none( ) && it. in_token( ) . is_none( ) && it. iterable( ) . is_none( ) {
272242 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] ) ;
273247 }
274248
275- // Tricky: add logic to add in just a pattern or iterable if not all
276- // the pieces are missing
277-
278249 if it. loop_body( ) . is_none( ) {
279250 append. insert( node. clone( ) . into( ) , vec![
280251 SyntheticToken {
@@ -398,6 +369,18 @@ fn foo () {for _ in __ra_fixup {}}
398369 )
399370 }
400371
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+ }
401384 #[ test]
402385 fn for_no_iter ( ) {
403386 check (
@@ -435,7 +418,7 @@ fn foo() {
435418}
436419"# ,
437420 expect ! [ [ r#"
438- fn foo () {match __ra_fixup {_ => {} }}
421+ fn foo () {match __ra_fixup {}}
439422"# ] ] ,
440423 )
441424 }
@@ -467,7 +450,7 @@ fn foo() {
467450}
468451"# ,
469452 expect ! [ [ r#"
470- fn foo () {match __ra_fixup {_ => {} }}
453+ fn foo () {match __ra_fixup {}}
471454"# ] ] ,
472455 )
473456 }
0 commit comments