     %{args: args, width: width, strings: strings?} = spec
 
     opts = %{
-      opts |
-      charlists: inspect_charlists(strings?, opts),
-      limit: inspect_limit(char, args, opts),
-      width: inspect_width(char, width),
+      opts
+      | charlists: inspect_charlists(strings?, opts),
+        limit: inspect_limit(char, args, opts),
+        width: inspect_width(char, width)
     }
 
     %{@inspected_format_spec | args: [inspect_data(args, opts)]}
   end
+
   defp handle_format_spec(spec, _opts), do: spec
 
   defp inspect_charlists(false, _), do: :as_lists

  cluster but we never truncate in the middle of a binary
  codepoint. For this reason, truncation is not exact.
  """
  @spec truncate(IO.chardata, non_neg_integer) :: IO.chardata
  def truncate(chardata, :infinity) when is_binary(chardata) or is_list(chardata) do
    chardata
  end
  def truncate(chardata, n) when n >= 0 do
    {chardata, n} = truncate_n(chardata, n)
    if n >= 0, do: chardata, else: [chardata, " (truncated)"]

  check `:io_lib.scan_format/2`
  """
  def scan_inspect(format, args, truncate, opts \\ %Inspect.Opts{})

  def scan_inspect(format, args, truncate, opts) when is_atom(format) do
    scan_inspect(Atom.to_charlist(format), args, truncate, opts)
  end

  def scan_inspect(format, args, truncate, opts) when is_binary(format) do
    scan_inspect(:binary.bin_to_list(format), args, truncate, opts)
  end

  def scan_inspect(format, [], _truncate, _opts) when is_list(format) do
    :io_lib.scan_format(format, [])
  end

  def scan_inspect(format, args, truncate, opts) when is_list(format) do
    # A pre-pass that removes binaries from
    # arguments according to the truncate limit.
    {args, _} =
      Enum.map_reduce(args, truncate, fn arg, acc ->
        if is_binary(arg) do
          truncate_n(arg, acc)
        else
          {arg, acc}
        end
      end)

    format
    |> :io_lib.scan_format(args)
