1
Fork 0
mirror of https://github.com/RGBCube/cstree synced 2025-07-27 09:07:44 +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

@ -74,7 +74,7 @@ impl<'input> Lexer<'input> {
fn next_token(&mut self) -> Result<Token<'input>, 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);
};

View file

@ -433,14 +433,12 @@ impl<S: Syntax, D> SyntaxNode<S, D> {
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 };