Skip to content

Commit 0aafb38

Browse files
committed
[stdlib] remove unneeded replaceSubrange branch
1 parent a385dec commit 0aafb38

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

stdlib/public/core/ArrayBufferProtocol.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,10 @@ extension _ArrayBufferProtocol {
165165
}
166166

167167
// resize the hole to make it the correct size
168-
if growth != 0 {
169-
let tailStart = elements + subrange.upperBound
170-
let tailCount = oldCount - subrange.upperBound
171-
holeEnd.moveInitialize(from: tailStart, count: tailCount)
172-
}
168+
// safe to always call, moveInitialize to the same location is a no-op
169+
let tailStart = elements + subrange.upperBound
170+
let tailCount = oldCount - subrange.upperBound
171+
holeEnd.moveInitialize(from: tailStart, count: tailCount)
173172

174173
// place the values into the hole we created
175174
if newCount > 0 {

0 commit comments

Comments
 (0)