diff --git a/src/bong/lexer.rs b/src/bong/lexer.rs index d7a10ba..6e2385c 100644 --- a/src/bong/lexer.rs +++ b/src/bong/lexer.rs @@ -197,9 +197,7 @@ fn make_comment>( line: &mut usize, ) -> Result { let first_slash = iter.next().expect(NO_MUT_PEEK_NEXT_MESSAGE); - let second_character = if let Some(c) = iter.next() { - c - } else { + let Some(second_character) = iter.next() else { return Err(TokenError { error: "unexpected EOF".to_string(), col: *col, @@ -217,9 +215,7 @@ fn make_comment>( } }, '*' => { - let mut current = if let Some(c) = iter.next() { - c - } else { + let Some(mut current) = iter.next() else { return Err(TokenError { error: "unexpected EOF".to_string(), col: *col, @@ -287,9 +283,7 @@ pub fn lexer(code: &str) -> Vec { let mut col = 0; let mut line = 0; loop { - let char = if let Some(c) = iter.peek() { - c - } else { + let Some(char) = iter.peek() else { break tokens; };