Skip to content

Commit

Permalink
pin change was moved to 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffenDE committed Dec 12, 2024
1 parent 73e479f commit 0c4cfd6
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions lib/phoenix/naming.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ defmodule Phoenix.Naming do
|> underscore()
end

# TODO: remove conditional once we require Elixir 1.15 for existing apps
if Version.match?(System.version(), ">= 1.15.0") do
defmacrop maybe_pin(name) do
quote do
^unquote(name)
end
end
else
defmacrop maybe_pin(name) do
quote do
unquote(name)
end
end
end

@doc """
Removes the given suffix from the name if it exists.
Expand All @@ -58,8 +43,7 @@ defmodule Phoenix.Naming do
suffix_size = byte_size(suffix)
prefix_size = byte_size(string) - suffix_size
case string do
# TODO: replace maybe_pin with ^prefix_size once we require Elixir 1.15 for existing apps
<<prefix::binary-size(maybe_pin(prefix_size)), ^suffix::binary>> -> prefix
<<prefix::binary-size(prefix_size), ^suffix::binary>> -> prefix
_ -> string
end
end
Expand Down

0 comments on commit 0c4cfd6

Please sign in to comment.