Skip to content

v1.7.0

Choose a tag to compare

@novaugust novaugust released this 12 Aug 20:44
· 31 commits to main since this release

1.7.0

Surprising how fast numbers go up when you're following semver.

Two new features, one being a pipe optimization and the other a style-consistency-enforcer in cond statements.

Improvements

  • |> Enum.filter(fun) |> List.first([default]) => |> Enum.find([default], fun) (#242, h/t @janpieper)

cond

If the last clause's left-hand-side is a truthy atom, map literal, or tuple, rewrite it to be true

# before
cond do
  a -> b
  c -> d
  :else -> e
end

# styled
cond do
  a -> b
  c -> d
  true -> e
end

This also helps Styler identify 2-clause conds that can be rewritten to if/else more readily, like the following:

# before
cond do
  a -> b
  :else -> c
end

# styled
if a do
  b
else
  c
end