Skip to content

Commit 4d7d664

Browse files
committed
the power of if let chain compels you
1 parent aecdb92 commit 4d7d664

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clippy_lints/src/manual_clamp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ impl<'tcx> ClampSuggestion<'tcx> {
116116
}
117117
if let Some(max) = constant(cx, cx.typeck_results(), self.params.max)
118118
&& let Some(min) = constant(cx, cx.typeck_results(), self.params.min)
119+
&& let Some(ord) = Constant::partial_cmp(cx.tcx, max_type, &min, &max)
119120
{
120-
Constant::partial_cmp(cx.tcx, max_type, &min, &max).is_some_and(|o| o != Ordering::Greater)
121+
ord != Ordering::Greater
121122
} else {
122123
false
123124
}

0 commit comments

Comments
 (0)