diff --git a/cstree/examples/readme.rs b/cstree/examples/readme.rs index 77985a2..a61bf73 100644 --- a/cstree/examples/readme.rs +++ b/cstree/examples/readme.rs @@ -74,7 +74,7 @@ impl<'input> Lexer<'input> { fn next_token(&mut self) -> Result, String> { loop { - let Some(next_char) = self.input.chars().next() else { + let Some(next_char) = self.input.chars().next() else { self.at_eof = true; return Ok(Token::EoF); }; diff --git a/cstree/src/syntax/node.rs b/cstree/src/syntax/node.rs index 660e4b2..30749d0 100644 --- a/cstree/src/syntax/node.rs +++ b/cstree/src/syntax/node.rs @@ -433,14 +433,12 @@ impl SyntaxNode { match elem { SyntaxElement::Node(node) => { // There are three things to handle here: - // 1) `node` was just created, which allocated `NodeData` that we now need to - // drop, and - // 2) dropping `node` will decrement the global `ref_count`, even though the - // count was not incremented when creating `node` (because it is an - // 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 the `ref_count`. Thus, we have to offset by 2 - // overall. + // 1) `node` was just created, which allocated `NodeData` that we now need to drop, and + // 2) dropping `node` will decrement the global `ref_count`, even though the count was not + // incremented when creating `node` (because it is an 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 + // the `ref_count`. Thus, we have to offset by 2 overall. // safety: `node` was just created and has not been shared let ref_count = unsafe { &*node.data().ref_count };