Skip to content

Commit 3f59e33

Browse files
authored
Merge pull request swiftlang#1580 from otaviolima/remove-nil-after-coalescing
[gardening] Remove nil coalescing operator where right hand operand is literal nil
2 parents 0567483 + 39a0797 commit 3f59e33

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Foundation/Bundle.swift

+1-1
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -678,19 +678,19 @@ extension NSString {
678678

679679
public func uppercased(with locale: Locale?) -> String {
680680
let mutableCopy = CFStringCreateMutableCopy(kCFAllocatorSystemDefault, 0, self._cfObject)!
681-
CFStringUppercase(mutableCopy, locale?._cfObject ?? nil)
681+
CFStringUppercase(mutableCopy, locale?._cfObject)
682682
return mutableCopy._swiftObject
683683
}
684684

685685
public func lowercased(with locale: Locale?) -> String {
686686
let mutableCopy = CFStringCreateMutableCopy(kCFAllocatorSystemDefault, 0, self._cfObject)!
687-
CFStringLowercase(mutableCopy, locale?._cfObject ?? nil)
687+
CFStringLowercase(mutableCopy, locale?._cfObject)
688688
return mutableCopy._swiftObject
689689
}
690690

691691
public func capitalized(with locale: Locale?) -> String {
692692
let mutableCopy = CFStringCreateMutableCopy(kCFAllocatorSystemDefault, 0, self._cfObject)!
693-
CFStringCapitalize(mutableCopy, locale?._cfObject ?? nil)
693+
CFStringCapitalize(mutableCopy, locale?._cfObject)
694694
return mutableCopy._swiftObject
695695
}
696696

0 commit comments

Comments
 (0)