Open
Description
when running this code
fn main() {
println!("{}", 0u8.clamp(7,3))
}
i get the following output
thread 'main' panicked at /playground/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/cmp.rs:1078:9:
assertion failed: min <= max
this is very unhelpful in any non-trivial codebase that uses this method.
this is a pretty niche error but it can happen.
something like
thread 'main' panicked at src/main.rs:3:20:
invalid clamp range : there are no numbers smaller than 7 and greater than 3
would be ideal, but any improvement would be good.