Skip to content

Commit

Permalink
Merge pull request #178 from tfiedlerdejanze/tf-random-corrections
Browse files Browse the repository at this point in the history
correct count example + typos
  • Loading branch information
novaugust authored Jun 14, 2024
2 parents e2b1abe + d632f12 commit c16d3a9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/module_directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ C.bar()

Styler won't lift aliases that will collide with existing aliases, and likewise won't lift any module whose name would collide with a standard library name.

You can specify additional modules to exlude from lifting via the `:alias_lifting_exclude` configuration option. For the example above, the following configuration would keep Styler from creating the `alias A.B.C` node:
You can specify additional modules to exclude from lifting via the `:alias_lifting_exclude` configuration option. For the example above, the following configuration would keep Styler from creating the `alias A.B.C` node:

```elixir
# .formatter.exs
Expand Down
4 changes: 2 additions & 2 deletions docs/pipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- add parens to function calls `|> fun |>` => `|> fun() |>`
- remove unnecessary `then/2`: `|> then(&f(&1, ...))` -> `|> f(...)`
- add `then` when defining anon funs in pipe `|> (& &1).() |>` => `|> |> then(& &1) |>`
- add `then/2` when defining anon funs in pipe `|> (& &1).() |>` => `|> then(& &1) |>`

## Piped function optimizations

Expand All @@ -19,7 +19,7 @@ Two function calls into one! Tries to fit everything on one line when shrinking.
| Before | After |
|--------|-------|
| `lhs \|> Enum.reverse() \|> Enum.concat(enum)` | `lhs \|> Enum.reverse(enum)` (also Kernel.++) |
| `lhs \|> Enum.filter(filterer) \|> Enum.count()` | `lhs \|> Enum.count(count)` |
| `lhs \|> Enum.filter(filterer) \|> Enum.count()` | `lhs \|> Enum.count(filterer)` |
| `lhs \|> Enum.map(mapper) \|> Enum.join(joiner)` | `lhs \|> Enum.map_join(joiner, mapper)` |
| `lhs \|> Enum.map(mapper) \|> Enum.into(empty_map)` | `lhs \|> Map.new(mapper)` |
| `lhs \|> Enum.map(mapper) \|> Map.new()` | `lhs \|> Map.new(mapper)` mapset & keyword also |
Expand Down
2 changes: 1 addition & 1 deletion test/style/pipes_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ defmodule Styler.Style.PipesTest do
assert_style "a |> then(&fun(&1, d)) |> c", "a |> fun(d) |> c()"
assert_style "a |> then(&M.f(&1)) |> c", "a |> M.f() |> c()"

# Doens't rewrite multiple refs / non-starting argument
# Doesn't rewrite multiple refs / non-starting argument
assert_style "a |> then(&fun(d, &1)) |> c()"
assert_style "a |> then(&fun(&1, d, %{foo: &1})) |> c()"

Expand Down

0 comments on commit c16d3a9

Please sign in to comment.