Fix segmentation fault

This segfault occurs in the future commits, but because it's more
important, I'm commiting it first.
This commit is contained in:
Aodhnait Étaín 2021-05-23 00:25:57 +01:00
parent fa2dcddd47
commit 9539389e4f

View file

@ -315,7 +315,7 @@ enum Token {
impl std::fmt::Display for Token { impl std::fmt::Display for Token {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
return match self { return match self {
token @ Token::IntegerLiteral(_) => write!(f, "{}", token), Token::IntegerLiteral(s) => write!(f, "{}", s),
token => write!(f, "{}", match token { token => write!(f, "{}", match token {
Token::Plus => "+", Token::Plus => "+",
Token::Semicolon => ";", Token::Semicolon => ";",