clippy_dogfood

This commit is contained in:
teor 2024-01-16 19:00:32 +10:00
parent 740441fd98
commit 6dfff19090

View File

@ -222,8 +222,7 @@ fn exprs_with_muldiv_binop_peeled<'e>(expr: &'e Expr<'_>) -> Vec<&'e Expr<'e>> {
let mut res = vec![];
for_each_expr(expr, |sub_expr| {
match sub_expr.kind {
ExprKind::Binary(op, lhs, _rhs) => {
if let ExprKind::Binary(op, lhs, _rhs) = sub_expr.kind {
if matches!(op.node, BinOpKind::Mul | BinOpKind::Div) {
// For binary operators which both contribute to the sign of the result,
// collect all their operands, recursively. This ignores overflow.
@ -242,12 +241,10 @@ fn exprs_with_muldiv_binop_peeled<'e>(expr: &'e Expr<'_>) -> Vec<&'e Expr<'e>> {
res.push(expr);
ControlFlow::Continue(Descend::No)
}
},
} else {
// For other expressions, including unary operators and constants, try to evaluate the expression.
_ => {
res.push(expr);
ControlFlow::Continue(Descend::No)
},
}
});