Skip to content

Commit a4bedb6

Browse files
Merge #520
520: `pairs()` is not necessary when iterating over a `Base.Dict` r=DilumAluthge a=DilumAluthge Addresses #514 (comment) Co-authored-by: Dilum Aluthge <[email protected]>
2 parents d68567d + 079676b commit a4bedb6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/registry_testing.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,12 @@ end
262262
# Apply `_spacify_hyphens()` recursively through a dictionary
263263
function _spacify_hyphens(dict::Dict{K, V}) where {K, V}
264264
new_dict = Dict{K, V}()
265-
for (k, v) in pairs(dict)
265+
# Note: `Base.Dict` iterates key-value pairs, so it's sufficient for us to do
266+
# `for (k, v) in dict`. However, there are some other dictionary implementations
267+
# (such as the Dictionaries.jl package) that do not iterate key-value pairs. So,
268+
# if we ever decide to widen the type signature of this method, we'll need to
269+
# change `(k, v) in dict` to `(k, v) in pairs(dict)`.
270+
for (k, v) in dict
266271
new_k = _spacify_hyphens(k)
267272
new_v = _spacify_hyphens(v)
268273
end

0 commit comments

Comments
 (0)