This smells bad:
let millis = time % 1000;
match millis {
0..=199 => do_something(),
200..=599 => do_something_else(),
600..=999 => do_something_altogether_different(),
_ => panic!("There are only 1,000 ms in a second."),
}
The "_" case will never be called, as millis is time % 1000.
How can I rewrite this so that I only have three branches?
Ideally, I'd also like to remove the duplication that is 199/200, 599/600 and 999/1000/0.
If the best solution is not a match I'm happy to use some other control structure.