File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -93,8 +93,7 @@ fn replace<T: AstNode + PartialEq>(
9393 sorted_fields : impl IntoIterator < Item = T > ,
9494) {
9595 fields. zip ( sorted_fields) . for_each ( |( field, sorted_field) | {
96- // FIXME: remove `clone_for_update` when `SyntaxEditor` handles it for us
97- editor. replace ( field. syntax ( ) , sorted_field. syntax ( ) . clone_for_update ( ) )
96+ editor. replace ( field. syntax ( ) , sorted_field. syntax ( ) )
9897 } ) ;
9998}
10099
Original file line number Diff line number Diff line change @@ -154,6 +154,12 @@ pub(super) fn apply_edits(editor: SyntaxEditor) -> SyntaxEdit {
154154 }
155155 } ;
156156 }
157+ Change :: Replace ( SyntaxElement :: Node ( target) , Some ( SyntaxElement :: Node ( new_target) ) ) => {
158+ * target = tree_mutator. make_syntax_mut ( target) ;
159+ if new_target. ancestors ( ) . any ( |node| node == tree_mutator. immutable ) {
160+ * new_target = new_target. clone_for_update ( ) ;
161+ }
162+ }
157163 Change :: Replace ( target, _) | Change :: ReplaceWithMany ( target, _) => {
158164 * target = tree_mutator. make_element_mut ( target) ;
159165 }
You can’t perform that action at this time.
0 commit comments