Skip to content

Commit 8b615af

Browse files
committed
Fix clippy_dogfood
1 parent e74fe43 commit 8b615af

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

clippy_lints/src/casts/cast_sign_loss.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,18 @@ fn pow_call_result_sign(cx: &LateContext<'_>, base: &Expr<'_>, exponent: &Expr<'
173173

174174
match (base_sign, exponent_is_even) {
175175
// Non-negative bases always return non-negative results, ignoring overflow.
176-
(Sign::ZeroOrPositive, _) => Sign::ZeroOrPositive,
177-
176+
(Sign::ZeroOrPositive, _) |
178177
// Any base raised to an even exponent is non-negative.
179-
// This is true even if we don't know the value of the base.
180-
(_, Some(true)) => Sign::ZeroOrPositive,
178+
// These both hold even if we don't know the value of the base.
179+
(_, Some(true))
180+
=> Sign::ZeroOrPositive,
181181

182182
// A negative base raised to an odd exponent is non-negative.
183183
(Sign::Negative, Some(false)) => Sign::Negative,
184184

185-
// Negative or unknown base to an unknown exponent, or an unknown base to an odd exponent.
186-
(Sign::Negative | Sign::Uncertain, None) => Sign::Uncertain,
185+
// Negative/unknown base to an unknown exponent, or unknown base to an odd exponent.
186+
// Could be negative or positive depending on the actual values.
187+
(Sign::Negative | Sign::Uncertain, None) |
187188
(Sign::Uncertain, Some(false)) => Sign::Uncertain,
188189
}
189190
}

0 commit comments

Comments
 (0)