File tree Expand file tree Collapse file tree 1 file changed +15
-18
lines changed
crates/ide-assists/src/handlers Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -250,24 +250,21 @@ fn create_struct_def(
250250 field_list
251251 . fields ( )
252252 . filter_map ( |field| match field. ty ( ) ? {
253- ast:: Type :: PathType ( p) => {
254- let generic_arg_list = p. path ( ) ?. segment ( ) ?. generic_arg_list ( ) ?;
255- Some (
256- generic_arg_list
257- . generic_args ( )
258- . filter_map ( |generic_arg| {
259- if generic_arg. to_string ( ) == "Self" {
260- let type_arg =
261- make:: type_arg ( make:: ty ( & enum_. name ( ) ?. to_string ( ) ) )
262- . clone_for_update ( ) ;
263- Some ( ted:: replace ( generic_arg. syntax ( ) , type_arg. syntax ( ) ) )
264- } else {
265- None
266- }
267- } )
268- . count ( ) ,
269- )
270- }
253+ ast:: Type :: PathType ( p) => Some (
254+ p. syntax ( )
255+ . descendants_with_tokens ( )
256+ . filter_map ( |it| {
257+ if it. kind ( ) == T ! [ Self ] {
258+ let type_arg =
259+ make:: type_arg ( make:: ty ( & enum_. name ( ) ?. to_string ( ) ) )
260+ . clone_for_update ( ) ;
261+ Some ( ted:: replace ( it, type_arg. syntax ( ) ) )
262+ } else {
263+ None
264+ }
265+ } )
266+ . count ( ) ,
267+ ) ,
271268 _ => None ,
272269 } )
273270 . count ( ) ;
You can’t perform that action at this time.
0 commit comments