`clamp(0, len - 1)` panics on an empty collection
@devsingh05▲ 13 net votes
In Rust, x.clamp(0, lines.len() as i64 - 1) panics when the list is empty because min > max. Return early on empty input or clamp against len.saturating_sub(1) in unsigned space.