Skip to content

Commit 4bb40b2

Browse files
committed
Improve format helper definition in IO.ANSI
1 parent 0e8a651 commit 4bb40b2

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/elixir/lib/io/ansi.ex

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ defmodule IO.ANSI do
186186
[[[[[[], "Hello, "] | "\e[31m"] | "\e[1m"], "world!"] | "\e[0m"]
187187
188188
"""
189-
def format(chardata, emit \\ enabled?) when is_boolean(emit) do
190-
do_format(chardata, [], [], emit, :maybe)
189+
def format(chardata, emit? \\ enabled?) when is_boolean(emit?) do
190+
do_format(chardata, [], [], emit?, :maybe)
191191
end
192192

193193
@doc ~S"""
@@ -206,12 +206,12 @@ defmodule IO.ANSI do
206206
[[[[[[] | "\e[1m"], 87], 111], 114], 100]
207207
208208
"""
209-
def format_fragment(chardata, emit \\ enabled?) when is_boolean(emit) do
210-
do_format(chardata, [], [], emit, false)
209+
def format_fragment(chardata, emit? \\ enabled?) when is_boolean(emit?) do
210+
do_format(chardata, [], [], emit?, false)
211211
end
212212

213-
defp do_format([term | rest], rem, acc, emit, append_reset) do
214-
do_format(term, [rest | rem], acc, emit, append_reset)
213+
defp do_format([term | rest], rem, acc, emit?, append_reset) do
214+
do_format(term, [rest | rem], acc, emit?, append_reset)
215215
end
216216

217217
defp do_format(term, rem, acc, true, append_reset) when is_atom(term) do
@@ -222,19 +222,19 @@ defmodule IO.ANSI do
222222
do_format([], rem, acc, false, append_reset)
223223
end
224224

225-
defp do_format(term, rem, acc, emit, append_reset) when not is_list(term) do
226-
do_format([], rem, [acc | [term]], emit, append_reset)
225+
defp do_format(term, rem, acc, emit?, append_reset) when not is_list(term) do
226+
do_format([], rem, [acc, term], emit?, append_reset)
227227
end
228228

229-
defp do_format([], [next | rest], acc, emit, append_reset) do
230-
do_format(next, rest, acc, emit, append_reset)
229+
defp do_format([], [next | rest], acc, emit?, append_reset) do
230+
do_format(next, rest, acc, emit?, append_reset)
231231
end
232232

233233
defp do_format([], [], acc, true, true) do
234234
[acc | IO.ANSI.reset]
235235
end
236236

237-
defp do_format([], [], acc, _emit, _append_reset) do
237+
defp do_format([], [], acc, _emit?, _append_reset) do
238238
acc
239239
end
240240
end

lib/elixir/lib/uri.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ defmodule URI do
102102

103103
defp encode_kv_pair({key, value}) do
104104
encode_www_form(Kernel.to_string(key)) <>
105-
"=" <> encode_www_form(Kernel.to_string(value))
105+
"=" <> encode_www_form(Kernel.to_string(value))
106106
end
107107

108108
@doc """

0 commit comments

Comments
 (0)