Skip to content

Commit 34016a9

Browse files
authored
Merge pull request swiftlang#2305 from ikesyo/refactor-sortedCookies
2 parents 712e7b7 + 9079c94 commit 34016a9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: Foundation/HTTPCookieStorage.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,10 @@ open class HTTPCookieStorage: NSObject {
337337
@discussion proper sorting of cookies may require extensive string conversion, which can be avoided by allowing the system to perform the sorting. This API is to be preferred over the more generic -[HTTPCookieStorage cookies] API, if sorting is going to be performed.
338338
*/
339339
open func sortedCookies(using sortOrder: [NSSortDescriptor]) -> [HTTPCookie] {
340-
var result: [HTTPCookie] = []
341-
syncQ.sync {
340+
return syncQ.sync {
342341
let cookies = Array(allCookies.values) as NSArray
343-
result = cookies.sortedArray(using: sortOrder) as! [HTTPCookie]
342+
return cookies.sortedArray(using: sortOrder) as! [HTTPCookie]
344343
}
345-
return result
346344
}
347345
}
348346

0 commit comments

Comments
 (0)