@@ -188,6 +188,7 @@ fn generate_module_def(
188188 parent_impl : & Option < ast:: Impl > ,
189189 Module { name, body_items, use_items } : & Module ,
190190) -> ast:: Module {
191+ let make = SyntaxFactory :: without_mappings ( ) ;
191192 let items: Vec < _ > = if let Some ( impl_) = parent_impl. as_ref ( )
192193 && let Some ( self_ty) = impl_. self_ty ( )
193194 {
@@ -199,12 +200,12 @@ fn generate_module_def(
199200 . collect_vec ( ) ;
200201 let impl_detached = ast:: Impl :: cast ( impl_. syntax ( ) . clone_subtree ( ) ) . unwrap ( ) ;
201202 let mut editor = SyntaxEditor :: new ( impl_detached. syntax ( ) . clone ( ) ) ;
202- let make = SyntaxFactory :: with_mappings ( ) ;
203- let assoc_item_list = make . assoc_item_list ( assoc_items) ;
203+ let make_editor = SyntaxFactory :: with_mappings ( ) ;
204+ let assoc_item_list = make_editor . assoc_item_list ( assoc_items) ;
204205 if let Some ( existing_list) = impl_detached. assoc_item_list ( ) {
205206 editor. replace ( existing_list. syntax ( ) , assoc_item_list. syntax ( ) ) ;
206207 }
207- editor. add_mappings ( make . finish_with_mappings ( ) ) ;
208+ editor. add_mappings ( make_editor . finish_with_mappings ( ) ) ;
208209 let new_impl_node = editor. finish ( ) . new_root ( ) . clone ( ) ;
209210 let impl_ = ast:: Impl :: cast ( new_impl_node) . unwrap ( ) . reset_indent ( ) ;
210211 // Add the import for enum/struct corresponding to given impl block
@@ -218,10 +219,10 @@ fn generate_module_def(
218219 } ;
219220
220221 let items = items. into_iter ( ) . map ( |it| it. reset_indent ( ) . indent ( IndentLevel ( 1 ) ) ) . collect_vec ( ) ;
221- let module_body = make:: item_list ( Some ( items) ) ;
222+ let module_body = make. item_list ( items) ;
222223
223- let module_name = make:: name ( name) ;
224- make:: mod_ ( module_name, Some ( module_body) )
224+ let module_name = make. name ( name) ;
225+ make. mod_ ( module_name, Some ( module_body) )
225226}
226227
227228fn make_use_stmt_of_node_with_super ( node_syntax : & SyntaxNode ) -> ast:: Item {
0 commit comments