       assert_receive {:count, ^x}
 
   """
-  defmacro assert_receive(
-             pattern,
-             timeout \\ Application.fetch_env!(:ex_unit, :assert_receive_timeout),
-             failure_message \\ nil
-           ) do
+  defmacro assert_receive(pattern, timeout \\ nil, failure_message \\ nil) do
     code = escape_quoted(:assert_receive, [], pattern)
     assert_receive(pattern, timeout, failure_message, __CALLER__, code)
   end

        fn message ->
          unquote(suppress_warning(quoted_pattern))
        end
      end

    timeout =
      if is_integer(timeout) do
        timeout
      else
        quote do: ExUnit.Assertions.__timeout__(unquote(timeout))
      end

    failure_message =

  @max_mailbox_length 10

  @doc false
  def __timeout__(timeout, _) when is_integer(timeout) and timeout >= 0, do: timeout

  def __timeout__(nil, key), do: Application.fetch_env!(:ex_unit, key)

  def __timeout__(timeout, _),
    do: raise(ArgumentError, "timeout must be a non-negative integer, got: #{inspect(timeout)}")

  @doc false
