mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Nest all the or-patterns!
This commit is contained in:
parent
c82a9141ab
commit
95c8c65139
26 changed files with 133 additions and 151 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue