Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions stdlib/public/core/RangeReplaceableCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,10 @@ extension RangeReplaceableCollection {
@inlinable
public mutating func append<S: Sequence>(contentsOf newElements: __owned S)
where S.Element == Element {

let done:Void? = newElements.withContiguousStorageIfAvailable {
replaceSubrange(endIndex..<endIndex, with: $0)
}

if done == nil {
for element in newElements {
append(element)
}
let approximateCapacity = self.count + newElements.underestimatedCount
self.reserveCapacity(approximateCapacity)
for element in newElements {
append(element)
}
}

Expand Down