Skip to content

Commit 6722b19

Browse files
committed
all the work in one spot
1 parent 0e7b977 commit 6722b19

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/style/deprecations.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,13 @@ defmodule Styler.Style.Deprecations do
6060

6161
if Version.match?(System.version(), ">= 1.17.0-dev") do
6262
@to_timeout_vsn Version.parse!("1.17.0-dev")
63-
# `unit` is plural for erlang, but single_node style rewrites plural to_timeouts into singulars
6463
defp style({{:., _, [{:__block__, _, [:timer]}, unit]}, fm, [x]} = node) when unit in ~w(hours minutes seconds)a do
65-
if Styler.Config.version_compatible?(@to_timeout_vsn),
66-
do: {:to_timeout, fm, [[{{:__block__, [format: :keyword, line: fm[:line]], [unit]}, x}]]},
67-
else: node
64+
if Styler.Config.version_compatible?(@to_timeout_vsn) do
65+
unit = unit |> Atom.to_string() |> String.trim_trailing("s") |> String.to_atom()
66+
{:to_timeout, fm, [[{{:__block__, [format: :keyword, line: fm[:line]], [unit]}, x}]]}
67+
else
68+
node
69+
end
6870
end
6971
end
7072

0 commit comments

Comments
 (0)