Skip to content

Commit

Permalink
allocs
Browse files Browse the repository at this point in the history
  • Loading branch information
domluna committed Sep 23, 2024
1 parent 1ee5600 commit 845b989
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/styles/default/pretty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
can_separate_kwargs::Bool = true
end

function newctx(s::T; kwargs...) where {T}
fields = fieldnames(T)
new_values = NamedTuple{fields}(getfield(s, f) for f in fields)
return T(; new_values..., kwargs...)
function newctx(s::PrettyContext; kwargs...)
fields = fieldnames(PrettyContext)
values = map(field -> get(kwargs, field, getfield(s, field)), fields)
PrettyContext(values...)
end

function pretty(
Expand Down

0 comments on commit 845b989

Please sign in to comment.