@@ -651,9 +651,8 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
651
651
@inline( never)
652
652
internal mutating func _copyToNewBuffer( oldCount: Int) {
653
653
let newCount = oldCount + 1
654
- var newBuffer = Optional (
655
- _forceCreateUniqueMutableBuffer (
656
- & _buffer, countForNewBuffer: oldCount, minNewCapacity: newCount) )
654
+ var newBuffer = _forceCreateUniqueMutableBuffer (
655
+ & _buffer, countForNewBuffer: oldCount, minNewCapacity: newCount)
657
656
_arrayOutOfPlaceUpdate (
658
657
& _buffer, & newBuffer, oldCount, 0 , _IgnorePointer ( ) )
659
658
}
@@ -952,9 +951,8 @@ internal func _arrayOutOfPlaceReplace<
952
951
) {
953
952
let growth = insertCount - bounds. count
954
953
let newCount = source. count + growth
955
- var newBuffer = Optional (
956
- _forceCreateUniqueMutableBuffer (
957
- & source, newCount: newCount, requiredCapacity: newCount) )
954
+ var newBuffer = _forceCreateUniqueMutableBuffer (
955
+ & source, newCount: newCount, requiredCapacity: newCount)
958
956
959
957
_arrayOutOfPlaceUpdate (
960
958
& source, & newBuffer,
@@ -1128,7 +1126,7 @@ internal func _arrayOutOfPlaceUpdate<
1128
1126
_Buffer. Index == Int
1129
1127
> (
1130
1128
_ source: inout _Buffer ,
1131
- _ dest: inout _ContiguousArrayBuffer < _Buffer . Element > ? ,
1129
+ _ dest: inout _ContiguousArrayBuffer < _Buffer . Element > ,
1132
1130
_ headCount: Int , // Count of initial source elements to copy/move
1133
1131
_ newCount: Int , // Number of new elements to insert
1134
1132
_ initializeNewElements: Initializer
@@ -1137,12 +1135,12 @@ internal func _arrayOutOfPlaceUpdate<
1137
1135
_sanityCheck ( newCount >= 0 )
1138
1136
1139
1137
// Count of trailing source elements to copy/move
1140
- let tailCount = dest! . count - headCount - newCount
1138
+ let tailCount = dest. count - headCount - newCount
1141
1139
_sanityCheck ( headCount + tailCount <= source. count)
1142
1140
1143
1141
let sourceCount = source. count
1144
1142
let oldCount = sourceCount - headCount - tailCount
1145
- let destStart = dest! . firstElementAddress
1143
+ let destStart = dest. firstElementAddress
1146
1144
let newStart = destStart + headCount
1147
1145
let newEnd = newStart + newCount
1148
1146
@@ -1188,7 +1186,7 @@ internal func _arrayOutOfPlaceUpdate<
1188
1186
let tailEnd = source. endIndex
1189
1187
source. _copyContents ( subRange: tailStart..< tailEnd, initializing: newEnd)
1190
1188
}
1191
- source = _Buffer ( dest! , shiftedToStartIndex: source. startIndex)
1189
+ source = _Buffer ( dest, shiftedToStartIndex: source. startIndex)
1192
1190
}
1193
1191
1194
1192
internal struct _InitializePointer < T> : _PointerFunction {
@@ -1224,9 +1222,8 @@ internal func _outlinedMakeUniqueBuffer<
1224
1222
return
1225
1223
}
1226
1224
1227
- var newBuffer = Optional (
1228
- _forceCreateUniqueMutableBuffer (
1229
- & buffer, newCount: bufferCount, requiredCapacity: bufferCount) )
1225
+ var newBuffer = _forceCreateUniqueMutableBuffer (
1226
+ & buffer, newCount: bufferCount, requiredCapacity: bufferCount)
1230
1227
_arrayOutOfPlaceUpdate ( & buffer, & newBuffer, bufferCount, 0 , _IgnorePointer ( ) )
1231
1228
}
1232
1229
@@ -1245,9 +1242,8 @@ internal func _arrayReserve<
1245
1242
return
1246
1243
}
1247
1244
1248
- var newBuffer = Optional (
1249
- _forceCreateUniqueMutableBuffer (
1250
- & buffer, newCount: count, requiredCapacity: requiredCapacity) )
1245
+ var newBuffer = _forceCreateUniqueMutableBuffer (
1246
+ & buffer, newCount: count, requiredCapacity: requiredCapacity)
1251
1247
_arrayOutOfPlaceUpdate ( & buffer, & newBuffer, count, 0 , _IgnorePointer ( ) )
1252
1248
}
1253
1249
0 commit comments