File tree Expand file tree Collapse file tree
crates/syntax/src/syntax_editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -217,9 +217,9 @@ pub(super) fn apply_edits(editor: SyntaxEditor) -> SyntaxEdit {
217217 }
218218 Change :: Insert ( _, SyntaxElement :: Token ( token) )
219219 | Change :: Replace ( _, Some ( SyntaxElement :: Token ( token) ) ) => {
220- if token . parent ( ) . is_some ( ) {
220+ if let Some ( parent ) = token . parent ( ) {
221221 let idx = token. index ( ) ;
222- let new_parent = token . parent ( ) . unwrap ( ) . clone_subtree ( ) . clone_for_update ( ) ;
222+ let new_parent = parent. clone_subtree ( ) . clone_for_update ( ) ;
223223 * token = new_parent
224224 . children_with_tokens ( )
225225 . nth ( idx)
@@ -240,10 +240,9 @@ pub(super) fn apply_edits(editor: SyntaxEditor) -> SyntaxEdit {
240240 }
241241 }
242242 SyntaxElement :: Token ( token) => {
243- if token . parent ( ) . is_some ( ) {
243+ if let Some ( parent ) = token . parent ( ) {
244244 let idx = token. index ( ) ;
245- let new_parent =
246- token. parent ( ) . unwrap ( ) . clone_subtree ( ) . clone_for_update ( ) ;
245+ let new_parent = parent. clone_subtree ( ) . clone_for_update ( ) ;
247246 * token = new_parent
248247 . children_with_tokens ( )
249248 . nth ( idx)
You can’t perform that action at this time.
0 commit comments