Skip to content

Commit 248d04b

Browse files
authored
Merge pull request #19952 from lorentey/collectionofone-modify
[stdlib] CollectionOfOne.subscript: Replace setter with _modify
2 parents 3af5bd1 + aedf2b9 commit 248d04b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/core/CollectionOfOne.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ extension CollectionOfOne: RandomAccessCollection, MutableCollection {
131131
_precondition(position == 0, "Index out of range")
132132
return _element
133133
}
134-
set {
134+
_modify {
135135
_precondition(position == 0, "Index out of range")
136-
_element = newValue
136+
yield &_element
137137
}
138138
}
139139

0 commit comments

Comments
 (0)