Skip to content

Commit 6d2d2e0

Browse files
authored
Merge pull request #38091 from glessard/indexing-model
[stdlib] fix an indexing inconsistency
2 parents 35fc9ea + 17c19fb commit 6d2d2e0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

stdlib/public/core/Sequence.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,24 +1164,24 @@ extension Sequence {
11641164
@inlinable
11651165
public __consuming func _copyContents(
11661166
initializing buffer: UnsafeMutableBufferPointer<Element>
1167-
) -> (Iterator,UnsafeMutableBufferPointer<Element>.Index) {
1167+
) -> (Iterator, UnsafeMutableBufferPointer<Element>.Index) {
11681168
return _copySequenceContents(initializing: buffer)
11691169
}
11701170

11711171
@_alwaysEmitIntoClient
11721172
internal __consuming func _copySequenceContents(
11731173
initializing buffer: UnsafeMutableBufferPointer<Element>
1174-
) -> (Iterator,UnsafeMutableBufferPointer<Element>.Index) {
1174+
) -> (Iterator, UnsafeMutableBufferPointer<Element>.Index) {
11751175
var it = self.makeIterator()
1176-
guard var ptr = buffer.baseAddress else { return (it,buffer.startIndex) }
1177-
for idx in buffer.startIndex..<buffer.count {
1176+
guard var ptr = buffer.baseAddress else { return (it, buffer.startIndex) }
1177+
for idx in buffer.indices {
11781178
guard let x = it.next() else {
11791179
return (it, idx)
11801180
}
11811181
ptr.initialize(to: x)
11821182
ptr += 1
11831183
}
1184-
return (it,buffer.endIndex)
1184+
return (it, buffer.endIndex)
11851185
}
11861186

11871187
@inlinable

0 commit comments

Comments
 (0)