aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/consteval.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-17 17:22:32 +0100
committerGitHub <[email protected]>2021-06-17 17:22:32 +0100
commitce926aebc4461e38535047958c0b6f72b7a0c0ea (patch)
tree4b844e0681b459836bac22c34bee43e4dfa3dc5f /crates/hir_ty/src/consteval.rs
parent3ae0c5911ab50ee209179ee4329b0551abe6fc48 (diff)
parent02d25ab60d2701ce71fe2dfaca36627ad902e229 (diff)
Merge #9315
9315: Nest all the or-patterns! r=Veykril a=Veykril `cargo +nightly clippy --fix -Z unstable-options --allow-dirty -- -A clippy::all -D clippy::unnested_or_patterns` Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/consteval.rs')
-rw-r--r--crates/hir_ty/src/consteval.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/crates/hir_ty/src/consteval.rs b/crates/hir_ty/src/consteval.rs
index 6f0bf8f8c..ab1afce08 100644
--- a/crates/hir_ty/src/consteval.rs
+++ b/crates/hir_ty/src/consteval.rs
@@ -38,8 +38,7 @@ impl ConstExt for Const {
38// FIXME: support more than just evaluating literals 38// FIXME: support more than just evaluating literals
39pub fn eval_usize(expr: &Expr) -> Option<u64> { 39pub fn eval_usize(expr: &Expr) -> Option<u64> {
40 match expr { 40 match expr {
41 Expr::Literal(Literal::Uint(v, None)) 41 Expr::Literal(Literal::Uint(v, None | Some(BuiltinUint::Usize))) => (*v).try_into().ok(),
42 | Expr::Literal(Literal::Uint(v, Some(BuiltinUint::Usize))) => (*v).try_into().ok(),
43 _ => None, 42 _ => None,
44 } 43 }
45} 44}