From 96a4b15c79d4d4073e93f31ae9aad455cd09cdfe Mon Sep 17 00:00:00 2001 From: brianschnee Date: Wed, 6 Mar 2024 21:21:32 -0500 Subject: [PATCH] remove unecessary option --- src/lexer.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lexer.rs b/src/lexer.rs index 9751102..ee40d62 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -15,7 +15,7 @@ impl<'a> Lexer<'a> { } } - fn group_while(&mut self, start: usize, c: char, condition: F) -> Option<&str> + fn group_while(&mut self, start: usize, c: char, condition: F) -> &str where F: Fn(char) -> bool, { @@ -25,7 +25,7 @@ impl<'a> Lexer<'a> { end = i + c.len_utf8(); } - Some(&self.input[start..end]) + &self.input[start..end] } } @@ -52,12 +52,12 @@ impl<'a> Iterator for Lexer<'a> { '>' => Token::GreaterThan, _ if c.is_alphabetic() => { let value = self.group_while(i, c, char::is_alphabetic); - Token::Ident(value?.into()) + Token::Ident(value.into()) } _ if c.is_numeric() => { let value = self.group_while(i, c, char::is_numeric); - match value?.parse() { + match value.parse() { Ok(val) => Token::Int(val), Err(_) => Token::Illegal, }