@@ -128,13 +128,14 @@ pub(super) fn apply_edits(editor: SyntaxEditor) -> SyntaxEdit {
128
128
129
129
// Add to changed ancestors, if applicable
130
130
match change {
131
- Change :: Insert ( _ , _ ) | Change :: InsertAll ( _ , _) => { }
132
- Change :: Replace ( target , _ ) | Change :: ReplaceWithMany ( target, _) => {
131
+ Change :: Replace ( SyntaxElement :: Node ( target ) , _)
132
+ | Change :: ReplaceWithMany ( SyntaxElement :: Node ( target) , _) => {
133
133
changed_ancestors. push_back ( ChangedAncestor :: single ( target, change_index) )
134
134
}
135
135
Change :: ReplaceAll ( range, _) => {
136
136
changed_ancestors. push_back ( ChangedAncestor :: multiple ( range, change_index) )
137
137
}
138
+ _ => ( ) ,
138
139
}
139
140
}
140
141
@@ -304,13 +305,8 @@ enum ChangedAncestorKind {
304
305
}
305
306
306
307
impl ChangedAncestor {
307
- fn single ( element : & SyntaxElement , change_index : usize ) -> Self {
308
- let kind = match element {
309
- SyntaxElement :: Node ( node) => ChangedAncestorKind :: Single { node : node. clone ( ) } ,
310
- SyntaxElement :: Token ( token) => {
311
- ChangedAncestorKind :: Single { node : token. parent ( ) . unwrap ( ) }
312
- }
313
- } ;
308
+ fn single ( node : & SyntaxNode , change_index : usize ) -> Self {
309
+ let kind = ChangedAncestorKind :: Single { node : node. clone ( ) } ;
314
310
315
311
Self { kind, change_index }
316
312
}
0 commit comments