Skip to content

Suggest using == instead of matches! #14688

Open
@emilk

Description

@emilk

What it does

Looks for unnecessary uses of matches! that can be replaced with == or !=

Advantage

Using matches! can produce unnecessarily complex code. When negated, you also get the "double-bang" confusion of !matches!(…), where tje twp ! means different things.

Drawbacks

No response

Example

if !matches!(value, Enum::Variant) {

Could be written as:

if value != Enum::Variant {

Metadata

Metadata

Assignees

Labels

A-lintArea: New lints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions