@@ -64,40 +64,38 @@ impl ast::Fn {
64
64
) {
65
65
match self . generic_param_list ( ) {
66
66
Some ( generic_param_list) => match generic_param_list. generic_params ( ) . last ( ) {
67
- Some ( _last_param ) => {
67
+ Some ( last_param ) => {
68
68
// There exists a generic param list and it's not empty
69
69
let position = generic_param_list. r_angle_token ( ) . map_or_else (
70
70
|| crate :: syntax_editor:: Position :: last_child_of ( self . syntax ( ) ) ,
71
71
crate :: syntax_editor:: Position :: before,
72
72
) ;
73
73
74
- if let Some ( last_param) = generic_param_list. generic_params ( ) . last ( ) {
75
- if last_param
76
- . syntax ( )
77
- . next_sibling_or_token ( )
78
- . map_or ( false , |it| it. kind ( ) == SyntaxKind :: COMMA )
79
- {
80
- editor. insert (
81
- crate :: syntax_editor:: Position :: after ( last_param. syntax ( ) ) ,
82
- new_param. syntax ( ) . clone ( ) ,
83
- ) ;
84
- editor. insert (
85
- crate :: syntax_editor:: Position :: after ( last_param. syntax ( ) ) ,
86
- make:: token ( SyntaxKind :: WHITESPACE ) ,
87
- ) ;
88
- editor. insert (
89
- crate :: syntax_editor:: Position :: after ( last_param. syntax ( ) ) ,
90
- make:: token ( SyntaxKind :: COMMA ) ,
91
- ) ;
92
- } else {
93
- let elements = vec ! [
94
- make:: token( SyntaxKind :: COMMA ) . into( ) ,
95
- make:: token( SyntaxKind :: WHITESPACE ) . into( ) ,
96
- new_param. syntax( ) . clone( ) . into( ) ,
97
- ] ;
98
- editor. insert_all ( position, elements) ;
99
- }
100
- } ;
74
+ if last_param
75
+ . syntax ( )
76
+ . next_sibling_or_token ( )
77
+ . map_or ( false , |it| it. kind ( ) == SyntaxKind :: COMMA )
78
+ {
79
+ editor. insert (
80
+ crate :: syntax_editor:: Position :: after ( last_param. syntax ( ) ) ,
81
+ new_param. syntax ( ) . clone ( ) ,
82
+ ) ;
83
+ editor. insert (
84
+ crate :: syntax_editor:: Position :: after ( last_param. syntax ( ) ) ,
85
+ make:: token ( SyntaxKind :: WHITESPACE ) ,
86
+ ) ;
87
+ editor. insert (
88
+ crate :: syntax_editor:: Position :: after ( last_param. syntax ( ) ) ,
89
+ make:: token ( SyntaxKind :: COMMA ) ,
90
+ ) ;
91
+ } else {
92
+ let elements = vec ! [
93
+ make:: token( SyntaxKind :: COMMA ) . into( ) ,
94
+ make:: token( SyntaxKind :: WHITESPACE ) . into( ) ,
95
+ new_param. syntax( ) . clone( ) . into( ) ,
96
+ ] ;
97
+ editor. insert_all ( position, elements) ;
98
+ }
101
99
}
102
100
None => {
103
101
// There exists a generic param list but it's empty
0 commit comments