Tokens - Use the matches! macro for is_litteral()
This commit is contained in:
parent
980729ceb3
commit
0872f58baf
1 changed files with 7 additions and 7 deletions
|
@ -57,13 +57,13 @@ pub struct Token {
|
||||||
impl Token {
|
impl Token {
|
||||||
/// Check whether a token corresponds to a litteral value.
|
/// Check whether a token corresponds to a litteral value.
|
||||||
pub fn is_litteral(&self) -> bool {
|
pub fn is_litteral(&self) -> bool {
|
||||||
match self.token_type {
|
matches!(
|
||||||
|
self.token_type,
|
||||||
TokenType::True
|
TokenType::True
|
||||||
| TokenType::False
|
| TokenType::False
|
||||||
| TokenType::Nil
|
| TokenType::Nil
|
||||||
| TokenType::String(_)
|
| TokenType::String(_)
|
||||||
| TokenType::Number(_) => true,
|
| TokenType::Number(_)
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue