Skip to content

Commit ec8ea63

Browse files
authored
Convert Enum.map/2+Enum.join/2 to Enum.map_join/3 (#585)
1 parent da2b3b5 commit ec8ea63

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

lib/ecto/migration.ex

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -942,10 +942,15 @@ defmodule Ecto.Migration do
942942
defp default_index_name(index) do
943943
[index.table, index.columns, "index"]
944944
|> List.flatten()
945-
|> Enum.map(&to_string(&1))
946-
|> Enum.map(&String.replace(&1, ~r"[^\w_]", "_"))
947-
|> Enum.map(&String.replace_trailing(&1, "_", ""))
948-
|> Enum.join("_")
945+
|> Enum.map_join(
946+
"_",
947+
fn item ->
948+
item
949+
|> to_string()
950+
|> String.replace(~r"[^\w]", "_")
951+
|> String.replace_trailing("_", "")
952+
end
953+
)
949954
|> String.to_atom()
950955
end
951956

0 commit comments

Comments
 (0)