about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/manual_clamp.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/clippy_lints/src/manual_clamp.rs b/clippy_lints/src/manual_clamp.rs
index f484672bc3a..59fc8948c2f 100644
--- a/clippy_lints/src/manual_clamp.rs
+++ b/clippy_lints/src/manual_clamp.rs
@@ -116,8 +116,9 @@ impl<'tcx> ClampSuggestion<'tcx> {
         }
         if let Some(max) = constant(cx, cx.typeck_results(), self.params.max)
             && let Some(min) = constant(cx, cx.typeck_results(), self.params.min)
+            && let Some(ord) = Constant::partial_cmp(cx.tcx, max_type, &min, &max)
         {
-            Constant::partial_cmp(cx.tcx, max_type, &min, &max).is_some_and(|o| o != Ordering::Greater)
+            ord != Ordering::Greater
         } else {
             false
         }