Skip to content

Commit aedf2b9

Browse files
committed
[stdlib] CollectionOfOne.subscript: Replace setter with _modify
1 parent a640fe7 commit aedf2b9

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)