the power of if let chain compels you

This commit is contained in:
Jacob Kiesel 2024-03-26 10:53:41 -06:00
parent aecdb921ae
commit 4d7d66462f

View file

@ -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
}