diff options
author | Fernando Tapia Rico <fertapric@gmail.com> | 2019-08-15 12:47:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-15 12:47:41 +0200 |
commit | b03cd62c1962c7dd891338b1f0c6fd1ef35476f3 (patch) | |
tree | 28fc78184ababfd1015ca9388b7872e7f6fe4c1e | |
parent | 3ae4ef7c03bc4eb7c1d37820b1475a6592067575 (diff) | |
download | elixir-b03cd62c1962c7dd891338b1f0c6fd1ef35476f3.tar.gz |
Correct guard in Enum slice optimization (#9296)
-rw-r--r-- | lib/elixir/lib/enum.ex | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/elixir/lib/enum.ex b/lib/elixir/lib/enum.ex index 2f35c50e6..5b6e471ba 100644 --- a/lib/elixir/lib/enum.ex +++ b/lib/elixir/lib/enum.ex @@ -3327,7 +3327,7 @@ defimpl Enumerable, for: List do @doc false def slice([], _start, _count, _size), do: [] def slice(_list, _start, 0, _size), do: [] - def slice(list, start, count, count), do: list |> drop(start) + def slice(list, start, count, size) when start + count == size, do: list |> drop(start) def slice(list, start, count, _size), do: list |> drop(start) |> take(count) defp drop(list, 0), do: list |