diff --git a/lib/drops/validator.ex b/lib/drops/validator.ex index b9609e3..ecc31d3 100644 --- a/lib/drops/validator.ex +++ b/lib/drops/validator.ex @@ -81,7 +81,7 @@ defmodule Drops.Validator do errors = Enum.reject(result, &is_ok/1) - if length(errors) == 0, + if Enum.empty?(errors), do: {:ok, {path, result}}, else: {:error, errors} diff --git a/lib/drops/validator/messages/error.ex b/lib/drops/validator/messages/error.ex index 1e0b460..dc87da6 100644 --- a/lib/drops/validator/messages/error.ex +++ b/lib/drops/validator/messages/error.ex @@ -105,7 +105,7 @@ defmodule Drops.Validator.Messages.Error do defstruct [:text, path: []] defimpl String.Chars, for: Error.Rule do - def to_string(%Error.Rule{text: text, path: path}) when length(path) == 0 do + def to_string(%Error.Rule{text: text, path: path}) when Enum.empty?(path) do text end