@@ -9,7 +9,7 @@ use ide_db::{
9
9
search:: FileReference ,
10
10
FxHashSet , RootDatabase ,
11
11
} ;
12
- use itertools:: { Itertools , Position } ;
12
+ use itertools:: Itertools ;
13
13
use syntax:: {
14
14
ast:: {
15
15
self , edit:: IndentLevel , edit_in_place:: Indent , make, AstNode , HasAttrs , HasGenericParams ,
@@ -298,37 +298,7 @@ fn update_variant(variant: &ast::Variant, generics: Option<ast::GenericParamList
298
298
let name = variant. name ( ) ?;
299
299
let ty = generics
300
300
. filter ( |generics| generics. generic_params ( ) . count ( ) > 0 )
301
- . map ( |generics| {
302
- let mut generic_str = String :: with_capacity ( 8 ) ;
303
-
304
- for ( p, more) in generics. generic_params ( ) . with_position ( ) . map ( |p| match p {
305
- Position :: First ( p) | Position :: Middle ( p) => ( p, true ) ,
306
- Position :: Last ( p) | Position :: Only ( p) => ( p, false ) ,
307
- } ) {
308
- match p {
309
- ast:: GenericParam :: ConstParam ( konst) => {
310
- if let Some ( name) = konst. name ( ) {
311
- generic_str. push_str ( name. text ( ) . as_str ( ) ) ;
312
- }
313
- }
314
- ast:: GenericParam :: LifetimeParam ( lt) => {
315
- if let Some ( lt) = lt. lifetime ( ) {
316
- generic_str. push_str ( lt. text ( ) . as_str ( ) ) ;
317
- }
318
- }
319
- ast:: GenericParam :: TypeParam ( ty) => {
320
- if let Some ( name) = ty. name ( ) {
321
- generic_str. push_str ( name. text ( ) . as_str ( ) ) ;
322
- }
323
- }
324
- }
325
- if more {
326
- generic_str. push_str ( ", " ) ;
327
- }
328
- }
329
-
330
- make:: ty ( & format ! ( "{}<{}>" , & name. text( ) , & generic_str) )
331
- } )
301
+ . map ( |generics| make:: ty ( & format ! ( "{}{}" , & name. text( ) , generics. to_generic_args( ) ) ) )
332
302
. unwrap_or_else ( || make:: ty ( & name. text ( ) ) ) ;
333
303
334
304
// change from a record to a tuple field list
0 commit comments