From 5e38b1ca95a0c6a9bf96847290ccbc05154847dd Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Tue, 18 Oct 2022 12:43:16 -0700 Subject: [PATCH] fmt --- rust/src/scanner.rs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/rust/src/scanner.rs b/rust/src/scanner.rs index 9ba9350..69e0977 100644 --- a/rust/src/scanner.rs +++ b/rust/src/scanner.rs @@ -194,21 +194,17 @@ impl<'a> Scanner<'a> { 's' if &self.source[1..self.current] == "uper".as_bytes() => TokenKind::Super, 'v' if &self.source[1..self.current] == "ar".as_bytes() => TokenKind::Var, 'w' if &self.source[1..self.current] == "hile".as_bytes() => TokenKind::While, - 'f' if self.current > 1 => { - match self.source[1] as char { - 'a' if &self.source[2..self.current] == "lse".as_bytes() => TokenKind::False, - 'o' if &self.source[2..self.current] == "r".as_bytes() => TokenKind::For, - 'u' if &self.source[2..self.current] == "n".as_bytes() => TokenKind::Fun, - _ => TokenKind::Identifier, - } + 'f' if self.current > 1 => match self.source[1] as char { + 'a' if &self.source[2..self.current] == "lse".as_bytes() => TokenKind::False, + 'o' if &self.source[2..self.current] == "r".as_bytes() => TokenKind::For, + 'u' if &self.source[2..self.current] == "n".as_bytes() => TokenKind::Fun, + _ => TokenKind::Identifier, + }, + 't' if self.current > 1 => match self.source[1] as char { + 'h' if &self.source[2..self.current] == "is".as_bytes() => TokenKind::This, + 'r' if &self.source[2..self.current] == "ue".as_bytes() => TokenKind::True, + _ => TokenKind::Identifier, }, - 't' if self.current > 1 => { - match self.source[1] as char { - 'h' if &self.source[2..self.current] == "is".as_bytes() => TokenKind::This, - 'r' if &self.source[2..self.current] == "ue".as_bytes() => TokenKind::True, - _ => TokenKind::Identifier, - } - } _ => TokenKind::Identifier, } }