Nest all the or-patterns!

This commit is contained in:
Lukas Wirth 2021-06-17 17:37:14 +02:00
parent c82a9141ab
commit 95c8c65139
26 changed files with 133 additions and 151 deletions

View file

@ -38,8 +38,7 @@ impl ConstExt for Const {
// FIXME: support more than just evaluating literals
pub fn eval_usize(expr: &Expr) -> Option<u64> {
match expr {
Expr::Literal(Literal::Uint(v, None))
| Expr::Literal(Literal::Uint(v, Some(BuiltinUint::Usize))) => (*v).try_into().ok(),
Expr::Literal(Literal::Uint(v, None | Some(BuiltinUint::Usize))) => (*v).try_into().ok(),
_ => None,
}
}