Closed
Description
This would also affect the single_match
lint. Essentially, whenever someone writes a pattern like this:
if let Ordering::Greater = a.cmp(b) { ... }
It would be a bit clearer to write something like this:
if a.cmp(b) == Ordering::Greater { ... }
Specifically, if the left hand side of the if let
contains a value that can be constructed directly, and the destructured value implements PartialEq
, then is makes a lot more sense to refactor the if let
into a direct comparison.
This would also affect the single_match
and single_match_else
lints to give proper suggestions, i.e. changing:
match a.cmp(b) {
Ordering::Greater => { ... },
_ => {},
}
to:
if a.cmp(b) == Ordering::Greater { ... }