Fix Clippy lints

This commit is contained in:
2023-03-07 10:33:52 +01:00
parent b49d7b7995
commit 091aa81e70
3 changed files with 7 additions and 7 deletions

View File

@@ -104,7 +104,7 @@ fn shunting_yard(tokens: &[Token]) -> Result<Vec<DecimalToken>, ()> {
}
}
}
_ => panic!("Unexpected token: {:?}", token),
_ => panic!("Unexpected token: {token:?}"),
}
}
@@ -132,7 +132,7 @@ fn evaluate_rpn(tokens: &[DecimalToken]) -> Result<f64, ()> {
};
stack.push(result);
}
_ => panic!("Unexpected token: {:?}", token),
_ => panic!("Unexpected token: {token:?}"),
}
}

View File

@@ -13,10 +13,10 @@ pub enum Expression {
impl fmt::Display for Expression {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Expression::Digit(value) => write!(f, "{}", value),
Expression::Parentheses(expr) => write!(f, "({})", expr),
Expression::Digit(value) => write!(f, "{value}"),
Expression::Parentheses(expr) => write!(f, "({expr})"),
Expression::Binary(operator, left, right) => {
write!(f, "{} {} {}", left, operator, right)
write!(f, "{left} {operator} {right}")
}
}
}