Skip to content

Commit 39a0797

Browse files
committed
Remove nil coalescing operator where right hand operand is literal nil
1 parent 3a3da52 commit 39a0797

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Foundation/Bundle.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ open class Bundle: NSObject {
226226
// MARK: - Path Resource Lookup - Class
227227

228228
open class func path(forResource name: String?, ofType ext: String?, inDirectory bundlePath: String) -> String? {
229-
return Bundle.url(forResource: name, withExtension: ext, subdirectory: bundlePath, in: URL(fileURLWithPath: bundlePath))?.path ?? nil
229+
return Bundle.url(forResource: name, withExtension: ext, subdirectory: bundlePath, in: URL(fileURLWithPath: bundlePath))?.path
230230
}
231231

232232
open class func paths(forResourcesOfType ext: String?, inDirectory bundlePath: String) -> [String] {

Foundation/NSString.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,19 +668,19 @@ extension NSString {
668668

669669
public func uppercased(with locale: Locale?) -> String {
670670
let mutableCopy = CFStringCreateMutableCopy(kCFAllocatorSystemDefault, 0, self._cfObject)!
671-
CFStringUppercase(mutableCopy, locale?._cfObject ?? nil)
671+
CFStringUppercase(mutableCopy, locale?._cfObject)
672672
return mutableCopy._swiftObject
673673
}
674674

675675
public func lowercased(with locale: Locale?) -> String {
676676
let mutableCopy = CFStringCreateMutableCopy(kCFAllocatorSystemDefault, 0, self._cfObject)!
677-
CFStringLowercase(mutableCopy, locale?._cfObject ?? nil)
677+
CFStringLowercase(mutableCopy, locale?._cfObject)
678678
return mutableCopy._swiftObject
679679
}
680680

681681
public func capitalized(with locale: Locale?) -> String {
682682
let mutableCopy = CFStringCreateMutableCopy(kCFAllocatorSystemDefault, 0, self._cfObject)!
683-
CFStringCapitalize(mutableCopy, locale?._cfObject ?? nil)
683+
CFStringCapitalize(mutableCopy, locale?._cfObject)
684684
return mutableCopy._swiftObject
685685
}
686686

0 commit comments

Comments
 (0)