about summary refs log tree commit diff
diff options
context:
space:
mode:
authorteor <teor@riseup.net>2024-01-16 18:09:16 +1000
committerteor <teor@riseup.net>2024-02-20 07:51:21 +1000
commit8b615af7608c243a2be777d36df59e75e2b553df (patch)
treed94f2739a8842d0fc2d56e1df1ac05cd1d592a7f
parente74fe4362ac6b79751aa1ddd72dfb256b006fff6 (diff)
downloadrust-8b615af7608c243a2be777d36df59e75e2b553df.tar.gz
rust-8b615af7608c243a2be777d36df59e75e2b553df.zip
Fix clippy_dogfood
-rw-r--r--clippy_lints/src/casts/cast_sign_loss.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/clippy_lints/src/casts/cast_sign_loss.rs b/clippy_lints/src/casts/cast_sign_loss.rs
index 530fb0dcde0..b1a0f46bb02 100644
--- a/clippy_lints/src/casts/cast_sign_loss.rs
+++ b/clippy_lints/src/casts/cast_sign_loss.rs
@@ -173,17 +173,18 @@ fn pow_call_result_sign(cx: &LateContext<'_>, base: &Expr<'_>, exponent: &Expr<'
 
     match (base_sign, exponent_is_even) {
         // Non-negative bases always return non-negative results, ignoring overflow.
-        (Sign::ZeroOrPositive, _) => Sign::ZeroOrPositive,
-
+        (Sign::ZeroOrPositive, _) |
         // Any base raised to an even exponent is non-negative.
-        // This is true even if we don't know the value of the base.
-        (_, Some(true)) => Sign::ZeroOrPositive,
+        // These both hold even if we don't know the value of the base.
+        (_, Some(true))
+            => Sign::ZeroOrPositive,
 
         // A negative base raised to an odd exponent is non-negative.
         (Sign::Negative, Some(false)) => Sign::Negative,
 
-        // Negative or unknown base to an unknown exponent, or an unknown base to an odd exponent.
-        (Sign::Negative | Sign::Uncertain, None) => Sign::Uncertain,
+        // Negative/unknown base to an unknown exponent, or unknown base to an odd exponent.
+        // Could be negative or positive depending on the actual values.
+        (Sign::Negative | Sign::Uncertain, None) |
         (Sign::Uncertain, Some(false)) => Sign::Uncertain,
     }
 }