diff --git a/rustfmt.toml b/rustfmt.toml index 4891004..2351305 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -9,7 +9,7 @@ wrap_comments = true format_code_in_doc_comments = true format_macro_matchers = true -merge_imports = true +imports_granularity= "Crate" reorder_impl_items = true diff --git a/src/syntax.rs b/src/syntax.rs index 411a3e4..a61a5d9 100644 --- a/src/syntax.rs +++ b/src/syntax.rs @@ -158,14 +158,12 @@ impl SyntaxNode { // safety: protected by the write lock let slot = unsafe { &mut *data.children.get_unchecked(i).get() }; let mut child_data = None; - if let Some(child) = slot { + if let Some(NodeOrToken::Node(node)) = slot { // Tokens have no children that point to them, so if there are no external pointers // and the pointer from the parent is dropped they will be dropped. // Nodes may be pointed to by their children, hence we check them first. - if let NodeOrToken::Node(node) = child { - node.drop_recursive(); - child_data = Some(node.data); - } + node.drop_recursive(); + child_data = Some(node.data); } // if the above `if let` was true, this drops `child` *slot = None;