lexer: fix clippy warnings
This commit is contained in:
parent
cf78869a9e
commit
ad6bf8932a
@ -197,9 +197,7 @@ fn make_comment<T: Iterator<Item = char>>(
|
||||
line: &mut usize,
|
||||
) -> Result<Token, TokenError> {
|
||||
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<T: Iterator<Item = char>>(
|
||||
}
|
||||
},
|
||||
'*' => {
|
||||
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<Token> {
|
||||
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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user