-
-
Notifications
You must be signed in to change notification settings - Fork 421
Prefer if over match #3520
Copy link
Copy link
Closed
Labels
help wantedExtra attention is neededExtra attention is neededlevel:starterGood for newcomersGood for newcomersrule requestAdding a new ruleAdding a new rule
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is neededlevel:starterGood for newcomersGood for newcomersrule requestAdding a new ruleAdding a new rule
Rule request
Thesis
We need to force users to prefer
ifover simplematchstatements.Example:
Can be rewritten as:
Reasoning
Simple
ifis better, less nested, and more performant thenmatch.When can we raise this violation?
matchcaseis simple, matching a single value or several valuesEventType.REJECT | EventType.REJECT2 | EventType.REJECT3caseis_(so it can be converted toelseeasily`)