Skip to content

Commit 611cac3

Browse files
committed
Add a rule about space before -> in "fn"
1 parent 187ca47 commit 611cac3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,22 @@
258258
end)
259259
```
260260

261+
* <a name="space-before-anonymous-fun-arrow"></a>
262+
Always use a space before `->` in 0-arity anonymous functions.
263+
<sup>[[link](#space-before-anonymous-fun-arrow)]</sup>
264+
265+
```elixir
266+
# Bad
267+
Task.async(fn->
268+
ExUnit.Diff.script(left, right)
269+
end)
270+
271+
# Good
272+
Task.async(fn ->
273+
ExUnit.Diff.script(left, right)
274+
end)
275+
```
276+
261277
* <a name="pipeline-operator"></a>
262278
Favor the pipeline operator `|>` to chain function calls together.
263279
<sup>[[link](#pipeline-operator)]</sup>

0 commit comments

Comments
 (0)