Closed
Description
Currently, for things like:
match foo
Enum::Variant => {...}
_ => {...}
}
we suggest using if let Enum::Variant = foo {...}
. However, in many cases, the enum implements PartialEq
, so we can just suggest if Enum::Variant == foo
.
This involves checking if the patterns in the match are simple PatIdent
s or PatEnum
s with empty pat-vecs (http://manishearth.github.io/rust-internals-docs/syntax/ast/enum.Pat_.html), and then checking if the type implements Eq
(not sure how this can be done, probably needs some mucking about in middle::ty
)