2026-08-23
You can use open ranges for numerical matching to reach exhaustiveness:
fn order_of_magnitude(n: u32) -> &'static str {
match n {
0..=9 => "single digit",
10..=99 => "double digit",
100..=999 => "triple digit",
1000.. => "four digits or more", // open upto u32::MAX
}
}