mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
fix: un-inline ConstScalarOrPath::from_expr_opt
This commit is contained in:
parent
db6a85d358
commit
d9336a496c
1 changed files with 2 additions and 4 deletions
|
@ -411,9 +411,7 @@ impl ConstScalarOrPath {
|
||||||
}
|
}
|
||||||
ast::Expr::PrefixExpr(prefix_expr) => match prefix_expr.op_kind() {
|
ast::Expr::PrefixExpr(prefix_expr) => match prefix_expr.op_kind() {
|
||||||
Some(ast::UnaryOp::Neg) => {
|
Some(ast::UnaryOp::Neg) => {
|
||||||
let unsigned = prefix_expr
|
let unsigned = Self::from_expr_opt(prefix_expr.expr());
|
||||||
.expr()
|
|
||||||
.map_or(Self::Scalar(ConstScalar::Unknown), Self::from_expr);
|
|
||||||
// Add sign
|
// Add sign
|
||||||
match unsigned {
|
match unsigned {
|
||||||
Self::Scalar(ConstScalar::UInt(num)) => {
|
Self::Scalar(ConstScalar::UInt(num)) => {
|
||||||
|
@ -422,7 +420,7 @@ impl ConstScalarOrPath {
|
||||||
other => other,
|
other => other,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => prefix_expr.expr().map_or(Self::Scalar(ConstScalar::Unknown), Self::from_expr),
|
_ => Self::from_expr_opt(prefix_expr.expr()),
|
||||||
},
|
},
|
||||||
ast::Expr::Literal(literal) => Self::Scalar(match literal.kind() {
|
ast::Expr::Literal(literal) => Self::Scalar(match literal.kind() {
|
||||||
ast::LiteralKind::IntNumber(num) => {
|
ast::LiteralKind::IntNumber(num) => {
|
||||||
|
|
Loading…
Reference in a new issue