Skip to content

Commit 0590552

Browse files
committed
[stdlib] remove unneeded replaceSubrange branch
1 parent c096203 commit 0590552

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
@@ -169,11 +169,10 @@ extension _ArrayBufferProtocol {
169169
}
170170

171171
// resize the hole to make it the correct size
172-
if growth != 0 {
173-
let tailStart = elements + subrange.upperBound
174-
let tailCount = oldCount - subrange.upperBound
175-
holeEnd.moveInitialize(from: tailStart, count: tailCount)
176-
}
172+
// safe to always call, moveInitialize to the same location is a no-op
173+
let tailStart = elements + subrange.upperBound
174+
let tailCount = oldCount - subrange.upperBound
175+
holeEnd.moveInitialize(from: tailStart, count: tailCount)
177176

178177
// place the values into the hole we created
179178
if newCount > 0 {

0 commit comments

Comments
 (0)