Tokens - Use the matches! macro for is_litteral()

This commit is contained in:
Emmanuel BENOîT 2022-12-31 10:19:36 +01:00
parent 980729ceb3
commit 0872f58baf

View file

@ -57,13 +57,13 @@ pub struct Token {
impl Token {
/// Check whether a token corresponds to a litteral value.
pub fn is_litteral(&self) -> bool {
match self.token_type {
matches!(
self.token_type,
TokenType::True
| TokenType::False
| TokenType::Nil
| TokenType::String(_)
| TokenType::Number(_) => true,
_ => false,
}
| TokenType::Number(_)
)
}
}