Credence.Pattern.NoCondTwoClauses
(credence v0.4.5)
Copy Markdown
Detects cond with exactly two clauses where the second guard is
true — a pattern that is just an if/else in disguise.
Bad
cond do
low > high -> false
true ->
mid = div(low + high, 2)
search(mid, target)
endGood
if low > high do
false
else
mid = div(low + high, 2)
search(mid, target)
endAuto-fix
Rewrites as if/else using the first clause's guard as the
condition. The condition is never modified.