Skip to content

Commit 9efd347

Browse files
committed
[gardening][Overlay] Use isEmpty in Data.swift
1 parent 0c8970d commit 9efd347

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/public/SDK/Foundation/Data.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ public final class _DataStorage {
854854
}
855855

856856
public func withInteriorPointerReference<T>(_ range: Range<Int>, _ work: (NSData) throws -> T) rethrows -> T {
857-
if range.count == 0 {
857+
if range.isEmpty {
858858
return try work(NSData()) // zero length data can be optimized as a singleton
859859
}
860860

@@ -886,7 +886,7 @@ public final class _DataStorage {
886886
}
887887

888888
public func bridgedReference(_ range: Range<Int>) -> NSData {
889-
if range.count == 0 {
889+
if range.isEmpty {
890890
return NSData() // zero length data can be optimized as a singleton
891891
}
892892

@@ -1464,7 +1464,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
14641464
/// - parameter buffer: The buffer of bytes to append. The size is calculated from `SourceType` and `buffer.count`.
14651465
@inline(__always)
14661466
public mutating func append<SourceType>(_ buffer : UnsafeBufferPointer<SourceType>) {
1467-
if buffer.count == 0 { return }
1467+
if buffer.isEmpty { return }
14681468
if !isKnownUniquelyReferenced(&_backing) {
14691469
_backing = _backing.mutableCopy(_sliceRange)
14701470
}
@@ -1588,7 +1588,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
15881588
@inline(__always)
15891589
public func subdata(in range: Range<Index>) -> Data {
15901590
_validateRange(range)
1591-
if count == 0 {
1591+
if isEmpty {
15921592
return Data()
15931593
}
15941594
return _backing.subdata(in: range)

0 commit comments

Comments
 (0)