@@ -334,8 +334,8 @@ public final class _DataStorage {
334
334
let tryCalloc = ( origLength == 0 || ( newLength / origLength) >= 4 )
335
335
if allocateCleared && tryCalloc {
336
336
newBytes = _DataStorage. allocate ( newCapacity, true )
337
- if newBytes != nil {
338
- _DataStorage. move ( newBytes! , _bytes!, origLength)
337
+ if let newBytes = newBytes {
338
+ _DataStorage. move ( newBytes, _bytes!, origLength)
339
339
_freeBytes ( )
340
340
}
341
341
}
@@ -344,8 +344,8 @@ public final class _DataStorage {
344
344
allocateCleared = false
345
345
if _deallocator != nil {
346
346
newBytes = _DataStorage. allocate ( newCapacity, true )
347
- if newBytes != nil {
348
- _DataStorage. move ( newBytes! , _bytes!, origLength)
347
+ if let newBytes = newBytes {
348
+ _DataStorage. move ( newBytes, _bytes!, origLength)
349
349
_freeBytes ( )
350
350
_deallocator = nil
351
351
}
@@ -360,8 +360,8 @@ public final class _DataStorage {
360
360
allocateCleared = clear && _DataStorage. shouldAllocateCleared ( newCapacity)
361
361
if allocateCleared && tryCalloc {
362
362
newBytes = _DataStorage. allocate ( newCapacity, true )
363
- if newBytes != nil {
364
- _DataStorage. move ( newBytes! , _bytes!, origLength)
363
+ if let newBytes = newBytes {
364
+ _DataStorage. move ( newBytes, _bytes!, origLength)
365
365
_freeBytes ( )
366
366
}
367
367
}
@@ -610,8 +610,8 @@ public final class _DataStorage {
610
610
memmove ( mutableBytes! + start + replacementLength, mutableBytes! + start + length, currentLength - start - length)
611
611
}
612
612
if replacementLength != 0 {
613
- if replacementBytes != nil {
614
- memmove ( mutableBytes! + start, replacementBytes! , replacementLength)
613
+ if let replacementBytes = replacementBytes {
614
+ memmove ( mutableBytes! + start, replacementBytes, replacementLength)
615
615
} else {
616
616
memset ( mutableBytes! + start, 0 , replacementLength)
617
617
}
0 commit comments