Skip to content

Commit 619ee42

Browse files
committed
Remove instances of broadcasting
While broadcasting is convenient syntax, it's tough on the compiler, and so likely not worth it in library code like this.
1 parent 03b823b commit 619ee42

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/faces.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,12 @@ function Face(; font::Union{Nothing, String} = nothing,
170170
else inherit end)
171171
end
172172

173-
Base.:(==)(a::Face, b::Face) =
174-
getfield.(Ref(a), fieldnames(Face)) ==
175-
getfield.(Ref(b), fieldnames(Face))
173+
function Base.:(==)(a::Face, b::Face)
174+
for f in fieldnames(Face)
175+
getfield(a, f) == getfield(b, f) || return false
176+
end
177+
true
178+
end
176179

177180
Base.hash(f::Face, h::UInt) =
178181
mapfoldr(Base.Fix1(getfield, f), hash, fieldnames(Face), init=hash(Face, h))
@@ -714,7 +717,7 @@ function Base.convert(::Type{Face}, spec::Dict{String,Any})
714717
elseif spec["inherit"] isa String
715718
[Symbol(spec["inherit"]::String)]
716719
elseif spec["inherit"] isa Vector{String}
717-
Symbol.(spec["inherit"]::Vector{String})
720+
[Symbol(name) for name in spec["inherit"]::Vector{String}]
718721
else
719722
Symbol[]
720723
end)

src/legacy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ legacy_color(color::Symbol) =
9393
end
9494

9595
function legacy_color(color::String)
96-
namedcolours = String.(NAMED_COLORS)
96+
namedcolours = map(String, NAMED_COLORS)
9797
if color in namedcolours
9898
legacy_color(Symbol(color))
9999
elseif 0 <= (color256 = something(tryparse(Int, color), -1)) <= 255

0 commit comments

Comments
 (0)