parser : match plus lisible pour parse_backslash

This commit is contained in:
Ahurac 2024-04-17 10:33:06 +02:00
parent 5584f49c87
commit eaa9622446

View file

@ -17,11 +17,10 @@ fn parse_quote(characters: &mut Vec<char>) -> String {
} }
fn parse_backslash(characters: &mut Vec<char>) -> Option<char> { fn parse_backslash(characters: &mut Vec<char>) -> Option<char> {
let mut escaped_char: Option<char> = None; let escaped_char = match characters.is_empty() {
false => Some(characters.pop().unwrap()),
if !characters.is_empty() { true => None,
escaped_char = Some(characters.pop().unwrap()); };
}
escaped_char escaped_char
} }