Skip to content

Commit 85f3a33

Browse files
committed
Clean up Base.show
1 parent 26e4f8c commit 85f3a33

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/utils.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,10 @@ Base.oneunit(::Type{<:AbstractDimensions}) = error("There is no such thing as a
9494

9595
Base.show(io::IO, d::AbstractDimensions) =
9696
let tmp_io = IOBuffer()
97-
for k in keys(d)
98-
if !iszero(d[k])
99-
print(tmp_io, dimension_name(d, k))
100-
isone(d[k]) || pretty_print_exponent(tmp_io, d[k])
101-
print(tmp_io, " ")
102-
end
97+
for k in filter(k -> !iszero(d[k]), keys(d))
98+
print(tmp_io, dimension_name(d, k))
99+
isone(d[k]) || pretty_print_exponent(tmp_io, d[k])
100+
print(tmp_io, " ")
103101
end
104102
s = String(take!(tmp_io))
105103
s = replace(s, r"^\s*" => "")

0 commit comments

Comments
 (0)