single_match should suggest plain if
when possible
#173
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
E-medium
Call for participation: Medium difficulty level problem and requires some initial experience.
T-middle
Type: Probably requires verifiying types
Currently, for things like:
we suggest using
if let Enum::Variant = foo {...}
. However, in many cases, the enum implementsPartialEq
, so we can just suggestif Enum::Variant == foo
.This involves checking if the patterns in the match are simple
PatIdent
s orPatEnum
s with empty pat-vecs (http://manishearth.github.io/rust-internals-docs/syntax/ast/enum.Pat_.html), and then checking if the type implementsEq
(not sure how this can be done, probably needs some mucking about inmiddle::ty
)The text was updated successfully, but these errors were encountered: