File tree Expand file tree Collapse file tree 1 file changed +6
-20
lines changed Expand file tree Collapse file tree 1 file changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -390,26 +390,12 @@ impl ast::MatchArmList {
390
390
Some ( t) => t,
391
391
None => return self . clone ( ) ,
392
392
} ;
393
- let mut sib = r_curly. prev_sibling_or_token ( ) ;
394
- while let Some ( s) = sib. clone ( ) {
395
- if let Some ( tok) = s. as_token ( ) {
396
- if tok. kind ( ) != WHITESPACE {
397
- break ;
398
- }
399
- sib = s. prev_sibling_or_token ( ) ;
400
- } else {
401
- break ;
402
- }
403
- }
404
- let indent = " " . to_string ( ) + & leading_indent ( self . syntax ( ) ) . unwrap_or_default ( ) ;
405
- let sib = match sib {
406
- Some ( s) => s,
407
- None => return self . clone ( ) ,
408
- } ;
409
- let position = InsertPosition :: After ( sib. into ( ) ) ;
410
- let ws = tokens:: WsBuilder :: new ( & format ! ( "\n {}" , indent) ) ;
411
- let to_insert: ArrayVec < [ SyntaxElement ; 2 ] > =
412
- [ ws. ws ( ) . into ( ) , item. syntax ( ) . clone ( ) . into ( ) ] . into ( ) ;
393
+ let position = InsertPosition :: Before ( r_curly. into ( ) ) ;
394
+ let arm_ws = tokens:: WsBuilder :: new ( " " ) ;
395
+ let match_indent = & leading_indent ( self . syntax ( ) ) . unwrap_or_default ( ) ;
396
+ let match_ws = tokens:: WsBuilder :: new ( & format ! ( "\n {}" , match_indent) ) ;
397
+ let to_insert: ArrayVec < [ SyntaxElement ; 3 ] > =
398
+ [ arm_ws. ws ( ) . into ( ) , item. syntax ( ) . clone ( ) . into ( ) , match_ws. ws ( ) . into ( ) ] . into ( ) ;
413
399
self . insert_children ( position, to_insert)
414
400
}
415
401
}
You can’t perform that action at this time.
0 commit comments