diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-04 09:30:44 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-04 11:38:09 +0100 |
| commit | eb951c008beea502042db4a3a0e8d1f8b51f6f52 (patch) | |
| tree | 9856ee4ed0222222669de10e616a580b2a60135e /src/syntax/parser.rs | |
| parent | 33928a00dc58250e24da1dae4e5db17e7b598d70 (diff) | |
Style changes
Diffstat (limited to 'src/syntax/parser.rs')
| -rw-r--r-- | src/syntax/parser.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs index 4c8e1013..8d51f7eb 100644 --- a/src/syntax/parser.rs +++ b/src/syntax/parser.rs @@ -97,7 +97,7 @@ impl<'s> Parser<'s> { // Trailing trivia should not be wrapped into the new node. let idx = self.children.len(); self.children.push(SyntaxNode::default()); - self.children.extend(children.drain(until.0 ..)); + self.children.extend(children.drain(until.0..)); self.children[idx] = InnerNode::with_children(kind, children).into(); } @@ -177,7 +177,11 @@ impl<'s> Parser<'s> { /// Peek at the current token without consuming it. pub fn peek(&self) -> Option<&NodeKind> { - if self.eof { None } else { self.current.as_ref() } + if self.eof { + None + } else { + self.current.as_ref() + } } /// Peek at the current token, but only if it follows immediately after the @@ -192,7 +196,7 @@ impl<'s> Parser<'s> { /// Peek at the source of the current token. pub fn peek_src(&self) -> &'s str { - self.get(self.current_start() .. self.current_end()) + self.get(self.current_start()..self.current_end()) } /// Obtain a range of the source code. @@ -303,7 +307,7 @@ impl<'s> Parser<'s> { if group_mode != TokenMode::Markup { let start = self.trivia_start().0; target = self.current_start - - self.children[start ..].iter().map(SyntaxNode::len).sum::<usize>(); + - self.children[start..].iter().map(SyntaxNode::len).sum::<usize>(); self.children.truncate(start); } @@ -466,7 +470,7 @@ impl Marker { /// with the given `kind`. pub fn end(self, p: &mut Parser, kind: NodeKind) { let until = p.trivia_start().0.max(self.0); - let children = p.children.drain(self.0 .. until).collect(); + let children = p.children.drain(self.0..until).collect(); p.children .insert(self.0, InnerNode::with_children(kind, children).into()); } @@ -476,7 +480,7 @@ impl Marker { where F: FnMut(&SyntaxNode) -> Result<(), &'static str>, { - for child in &mut p.children[self.0 ..] { + for child in &mut p.children[self.0..] { // Don't expose errors. if child.kind().is_error() { continue; |
