about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/treewalk/parser.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-02-27T09·27+0200
committertazjin <mail@tazj.in>2021-02-27T13·05+0000
commit75750ba6835ae8ac3a97c24ca7ff5ebc1500f36d (patch)
tree35138b7ae42bcb6668b982224f6d5f3febbeafa6 /users/tazjin/rlox/src/treewalk/parser.rs
parentebc987f4aaf653c227d21bec5998c62e87da7f7b (diff)
style(tazjin/rlox): Set max_width=80 r/2235
Change-Id: Ib64831c0b97c94fdfbdbae64f4dfccc86879ef73
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2554
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'users/tazjin/rlox/src/treewalk/parser.rs')
-rw-r--r--users/tazjin/rlox/src/treewalk/parser.rs24
1 files changed, 19 insertions, 5 deletions
diff --git a/users/tazjin/rlox/src/treewalk/parser.rs b/users/tazjin/rlox/src/treewalk/parser.rs
index 8117c29726c9..003cc34b4665 100644
--- a/users/tazjin/rlox/src/treewalk/parser.rs
+++ b/users/tazjin/rlox/src/treewalk/parser.rs
@@ -213,7 +213,9 @@ impl Parser {
                 if params.len() >= 255 {
                     return Err(Error {
                         line: self.peek().line,
-                        kind: ErrorKind::InternalError("255 parameter limit exceeded.".into()),
+                        kind: ErrorKind::InternalError(
+                            "255 parameter limit exceeded.".into(),
+                        ),
                     });
                 }
 
@@ -427,7 +429,10 @@ impl Parser {
 
             return Err(Error {
                 line: equals.line,
-                kind: ErrorKind::InvalidAssignmentTarget(format!("{:?}", equals)),
+                kind: ErrorKind::InvalidAssignmentTarget(format!(
+                    "{:?}",
+                    equals
+                )),
             });
         }
 
@@ -490,7 +495,9 @@ impl Parser {
     }
 
     fn unary(&mut self) -> ExprResult {
-        if self.match_token(&TokenKind::Bang) || self.match_token(&TokenKind::Minus) {
+        if self.match_token(&TokenKind::Bang)
+            || self.match_token(&TokenKind::Minus)
+        {
             return Ok(Expr::Unary(Unary {
                 operator: self.previous().clone(),
                 right: Box::new(self.unary()?),
@@ -550,7 +557,10 @@ impl Parser {
 
             TokenKind::LeftParen => {
                 let expr = self.expression()?;
-                self.consume(&TokenKind::RightParen, ErrorKind::UnmatchedParens)?;
+                self.consume(
+                    &TokenKind::RightParen,
+                    ErrorKind::UnmatchedParens,
+                )?;
                 return Ok(Expr::Grouping(Grouping(Box::new(expr))));
             }
 
@@ -622,7 +632,11 @@ impl Parser {
         &self.tokens[self.current - 1]
     }
 
-    fn consume(&mut self, kind: &TokenKind, err: ErrorKind) -> Result<Token, Error> {
+    fn consume(
+        &mut self,
+        kind: &TokenKind,
+        err: ErrorKind,
+    ) -> Result<Token, Error> {
         if self.check_token(kind) {
             return Ok(self.advance());
         }