Skip to content

Commit 0d2eeea

Browse files
authored
Merge branch 'master' into constructors
2 parents f9df541 + b6427c0 commit 0d2eeea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ordered_dict.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ isordered(::Type{T}) where {T<:OrderedDict} = true
9898

9999
# conversion between OrderedDict types
100100
function convert(::Type{OrderedDict{K,V}}, d::AbstractDict) where {K,V}
101+
d isa OrderedDict{K, V} && return d
101102
if !isordered(typeof(d))
102103
Base.depwarn("Conversion to OrderedDict is deprecated for unordered associative containers (in this case, $(typeof(d))). Use an ordered or sorted associative type, such as SortedDict and OrderedDict.", :convert)
103104
end
@@ -112,7 +113,6 @@ function convert(::Type{OrderedDict{K,V}}, d::AbstractDict) where {K,V}
112113
end
113114
return h
114115
end
115-
convert(::Type{OrderedDict{K,V}},d::OrderedDict{K,V}) where {K,V} = d
116116

117117
isslotempty(slot_value::Integer) = slot_value == 0
118118
isslotfilled(slot_value::Integer) = slot_value > 0
@@ -493,4 +493,4 @@ function Base.map!(f, iter::Base.ValueIterator{<:OrderedDict})
493493
return iter
494494
end
495495

496-
last(h::OrderedDict) = h.keys[end] => h.vals[end]
496+
last(h::OrderedDict) = h.keys[end] => h.vals[end]

0 commit comments

Comments
 (0)