Use :binary instead of String in Macro.to_string for bitstrings

No need for grapheme handling and `str` is never of zero size.
This commit is contained in:
Aleksei Magusev
2015-12-26 14:31:19 +01:00
parent 4855d08c44
commit e1d5263560
+1 -1
View File
@@ -484,7 +484,7 @@ defmodule Macro do
else
result = Enum.map_join(parts, ", ", fn(part) ->
str = bitpart_to_string(part, fun)
if String.first(str) == "<" or String.last(str) == ">" do
if :binary.first(str) == ?< or :binary.last(str) == ?> do
"(" <> str <> ")"
else
str