-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.Call for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying typesType: Probably requires verifiying types
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
)
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.Call for participation: Medium difficulty level problem and requires some initial experience.T-middleType: Probably requires verifiying typesType: Probably requires verifiying types