-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
A-lintArea: New lintsArea: New lints
Description
What it does
Checks for the same condition being checked in a match guard and in the match body
Advantage
- Remove a likely typo or a copy and paste error
Drawbacks
- False negatives: if the condition is an impure function, it could've been called twice on purpose for its side effects
- removing a match guard might change the matching logic (so it might make sense to only suggest removing the inner
if
)
Example
match n {
0 if a > b => {
if a > b {
return;
}
}
_ => {}
}
Could be written as:
match n {
0 if a > b => {
return;
}
_ => {}
}
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lints