1
Fork 0
mirror of https://github.com/RGBCube/cstree synced 2025-07-27 17:17:45 +00:00

fix rustfmt complaints

This commit is contained in:
Domenic Quirl 2023-08-10 19:49:31 +02:00
parent 057d51f6e1
commit 03ac773d0e
2 changed files with 7 additions and 9 deletions

View file

@ -433,14 +433,12 @@ impl<S: Syntax, D> SyntaxNode<S, D> {
match elem { match elem {
SyntaxElement::Node(node) => { SyntaxElement::Node(node) => {
// There are three things to handle here: // There are three things to handle here:
// 1) `node` was just created, which allocated `NodeData` that we now need to // 1) `node` was just created, which allocated `NodeData` that we now need to drop, and
// drop, and // 2) dropping `node` will decrement the global `ref_count`, even though the count was not
// 2) dropping `node` will decrement the global `ref_count`, even though the // incremented when creating `node` (because it is an internal reference). Thus, we need to
// count was not incremented when creating `node` (because it is an // bump the count up by one.
// internal reference). Thus, we need to bump the count up by one. // 3) dropping `node`'s `NodeData` will drop its `parent` reference, which will again decrement
// 3) dropping `node`'s `NodeData` will drop its `parent` reference, which // the `ref_count`. Thus, we have to offset by 2 overall.
// will again decrement the `ref_count`. Thus, we have to offset by 2
// overall.
// safety: `node` was just created and has not been shared // safety: `node` was just created and has not been shared
let ref_count = unsafe { &*node.data().ref_count }; let ref_count = unsafe { &*node.data().ref_count };