RS.CLIPPY.MIN_MAX
`min(_, max(_, _))` (or vice versa) with bounds clamping the result to a constant
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: min_max. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for expressions where std::cmp::min and max are
used to clamp values, but switched so that the result is constant.
Why is this bad?
This is in all probability not the intended outcome. At the least it hurts readability of the code.
Example
min(0, max(100, x))
// or
x.max(100).min(0)
It will always be equal to 0. Probably the author meant to clamp the value
between 0 and 100, but has erroneously swapped min and max.