Skip to content

Commit 17ae84e

Browse files
author
José Valim
committed
Do not color map's => differently in inspect
1 parent 28505a7 commit 17ae84e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/elixir/lib/inspect.ex

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,20 +356,21 @@ defimpl Inspect, for: Map do
356356
open = color("%" <> name <> "{", :map, opts)
357357
sep = color(",", :map, opts)
358358
close = color("}", :map, opts)
359-
surround_many(open, map, close, opts, traverse_fun(map), sep)
359+
surround_many(open, map, close, opts, traverse_fun(map, opts), sep)
360360
end
361361

362-
defp traverse_fun(list) do
362+
defp traverse_fun(list, opts) do
363363
if Inspect.List.keyword?(list) do
364364
&Inspect.List.keyword/2
365365
else
366-
&to_map/2
366+
sep = color(" => ", :map, opts)
367+
&to_map(&1, &2, sep)
367368
end
368369
end
369370

370-
defp to_map({key, value}, opts) do
371+
defp to_map({key, value}, opts, sep) do
371372
concat(
372-
concat(to_doc(key, opts), " => "),
373+
concat(to_doc(key, opts), sep),
373374
to_doc(value, opts)
374375
)
375376
end

0 commit comments

Comments
 (0)