Merge pull request #703 from inju2403/cleanup/replaceelement-exchange-same-key

[OrderedCollections] Use exchange(_:with:) in replaceElement's equal-key path
This commit is contained in:
Karoy Lorentey authored and GitHub committed 2026-08-25 14:02:39 -07:00
commit fcfa3b00cb
1 file changed
+1 -2
@@ -83,8 +83,7 @@ extension OrderedDictionary {
// in place. The hash bucket is unchanged, so no rehash is needed.
if existingIndex == index {
let oldKey = _keys.update(key, at: index)
let oldValue = _values[index]
_values[index] = value
let oldValue = exchange(&_values[index], with: value)
_checkInvariants()
return (oldKey, oldValue)
}