We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ConstScalarOrPath::from_expr_opt
1 parent db6a85d commit d9336a4Copy full SHA for d9336a4
crates/hir-def/src/type_ref.rs
@@ -411,9 +411,7 @@ impl ConstScalarOrPath {
411
}
412
ast::Expr::PrefixExpr(prefix_expr) => match prefix_expr.op_kind() {
413
Some(ast::UnaryOp::Neg) => {
414
- let unsigned = prefix_expr
415
- .expr()
416
- .map_or(Self::Scalar(ConstScalar::Unknown), Self::from_expr);
+ let unsigned = Self::from_expr_opt(prefix_expr.expr());
417
// Add sign
418
match unsigned {
419
Self::Scalar(ConstScalar::UInt(num)) => {
@@ -422,7 +420,7 @@ impl ConstScalarOrPath {
422
420
other => other,
423
421
424
425
- _ => prefix_expr.expr().map_or(Self::Scalar(ConstScalar::Unknown), Self::from_expr),
+ _ => Self::from_expr_opt(prefix_expr.expr()),
426
},
427
ast::Expr::Literal(literal) => Self::Scalar(match literal.kind() {
428
ast::LiteralKind::IntNumber(num) => {
0 commit comments