@@ -5,9 +5,10 @@ use ide_db::{
55 defs:: Definition ,
66 search:: { SearchScope , UsageSearchResult } ,
77} ;
8+ use syntax:: ast:: syntax_factory:: SyntaxFactory ;
89use syntax:: {
910 AstNode ,
10- ast:: { self , HasGenericParams , HasName , HasTypeBounds , Name , NameLike , PathType , make } ,
11+ ast:: { self , HasGenericParams , HasName , HasTypeBounds , Name , NameLike , PathType } ,
1112 match_ast,
1213} ;
1314
@@ -72,6 +73,7 @@ pub(crate) fn replace_named_generic_with_impl(
7273 target,
7374 |edit| {
7475 let mut editor = edit. make_editor ( type_param. syntax ( ) ) ;
76+ let make = SyntaxFactory :: without_mappings ( ) ;
7577
7678 // remove trait from generic param list
7779 if let Some ( generic_params) = fn_. generic_param_list ( ) {
@@ -83,17 +85,14 @@ pub(crate) fn replace_named_generic_with_impl(
8385 if params. is_empty ( ) {
8486 editor. delete ( generic_params. syntax ( ) ) ;
8587 } else {
86- let new_generic_param_list = make:: generic_param_list ( params) ;
87- editor. replace (
88- generic_params. syntax ( ) ,
89- new_generic_param_list. syntax ( ) . clone_for_update ( ) ,
90- ) ;
88+ let new_generic_param_list = make. generic_param_list ( params) ;
89+ editor. replace ( generic_params. syntax ( ) , new_generic_param_list. syntax ( ) ) ;
9190 }
9291 }
9392
94- let new_bounds = make:: impl_trait_type ( type_bound_list) ;
93+ let new_bounds = make. impl_trait_type ( type_bound_list) ;
9594 for path_type in path_types_to_replace. iter ( ) . rev ( ) {
96- editor. replace ( path_type. syntax ( ) , new_bounds. clone_for_update ( ) . syntax ( ) ) ;
95+ editor. replace ( path_type. syntax ( ) , new_bounds. syntax ( ) ) ;
9796 }
9897 edit. add_file_edits ( ctx. vfs_file_id ( ) , editor) ;
9998 } ,
0 commit comments