chore: Apply Clippy lint `comparison_chain`
Description
Apply Clippy lint comparison_chain, which finds places where if ... else if statements can be replaced with match a.cmp(b)
There were a few locations where I didn't want to make this change, because I felt it would decrease readability by increasing the indent level for a large segment of code. I added #[allow(clippy::comparison_chain)] so Clippy will ignore them
@kantai I had mixed feelings on this, and some of the suggestions I skipped for this reason. Some of these do still result in more lines/indentation, but I think doing the cmp once and then matching the result is more clear than repeatedly comparing the same two things in an if ... else if ... else statement
I have to remember the directionality of cmp
It's intuitive, it's left-to-right just like you would read it. For example, 2.cmp(&4) returns Ordering::Less
From the call: let's take a closer look at this PR. Most of the changes here are in tests. Perhaps we enable this lint, and use its warnings as evidence that your code needs refactoring. If we go forward with matchs, we should document the if/else condition being matched to improve code clarity. The main pushback is that matchs are harder to read.