Skip to content

Commit ccb2fde

Browse files
committed
swift4: fully list closure arguments
1 parent 47f57cc commit ccb2fde

7 files changed

+20
-21
lines changed

Diff for: Foundation/NSArray.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ open class NSArray : NSObject, NSCopying, NSMutableCopying, NSSecureCoding, NSCo
381381
ptr.advanced(by: idx).pointee = Int32(hash).littleEndian
382382
}
383383
}
384-
return Data(bytesNoCopy: buffer, count: size, deallocator: .custom({ _ in
384+
return Data(bytesNoCopy: buffer, count: size, deallocator: .custom({ (_, _) in
385385
buffer.deallocate(capacity: size)
386386
}))
387387
}

Diff for: Foundation/NSError.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ open class NSError : NSObject, NSCopying, NSSecureCoding, NSCoding {
7070
if let info = aDecoder.decodeObject(of: [NSSet.self, NSDictionary.self, NSArray.self, NSString.self, NSNumber.self, NSData.self, NSURL.self], forKey: "NSUserInfo") as? NSDictionary {
7171
var filteredUserInfo = [String : Any]()
7272
// user info must be filtered so that the keys are all strings
73-
info.enumerateKeysAndObjects(options: []) {
74-
if let key = $0.0 as? NSString {
75-
filteredUserInfo[key._swiftObject] = $0.1
73+
info.enumerateKeysAndObjects({ (key, value, _) in
74+
if let key = key as? NSString {
75+
filteredUserInfo[key._swiftObject] = value
7676
}
77-
}
77+
})
7878
_userInfo = filteredUserInfo
7979
}
8080
}

Diff for: Foundation/NSIndexSet.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ open class NSIndexSet : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
9393

9494
open func mutableCopy(with zone: NSZone? = nil) -> Any {
9595
let set = NSMutableIndexSet()
96-
enumerateRanges(options: []) {
97-
set.add(in: $0.0)
96+
enumerateRanges(options: []) { (range, _) in
97+
set.add(in: range)
9898
}
9999
return set
100100
}

Diff for: Foundation/NSNotificationQueue.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ open class NotificationQueue: NSObject {
109109
var predicate: (NSNotificationListEntry) -> Bool
110110
switch coalesceMask {
111111
case [.onName, .onSender]:
112-
predicate = { (entryNotification, _) in
113-
return _SwiftValue.store(notification.object) !== _SwiftValue.store(entryNotification.object) || notification.name != entryNotification.name
112+
predicate = { entry in
113+
return _SwiftValue.store(notification.object) !== _SwiftValue.store(entry.0.object) || notification.name != entry.0.name
114114
}
115115
case [.onName]:
116-
predicate = { (entryNotification, _) in
117-
return notification.name != entryNotification.name
116+
predicate = { entry in
117+
return notification.name != entry.0.name
118118
}
119119
case [.onSender]:
120-
predicate = { (entryNotification, _) in
121-
return _SwiftValue.store(notification.object) !== _SwiftValue.store(entryNotification.object)
120+
predicate = { entry in
121+
return _SwiftValue.store(notification.object) !== _SwiftValue.store(entry.0.object)
122122
}
123123
default:
124124
return

Diff for: Foundation/NSXMLNode.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,8 @@ open class XMLNode: NSObject, NSCopying {
617617
if let parentNode = _CFXMLNodeGetParent(parent!) {
618618
let grandparent = XMLNode._objectNodeForNode(parentNode)
619619
let possibleParentNodes = grandparent.filter { $0.name == self.parent?.name }
620-
let count = possibleParentNodes.reduce(0) {
621-
return $0.0 + 1
620+
let count = possibleParentNodes.reduce(0) { (x, _) in
621+
return x + 1
622622
}
623623

624624
if count <= 1 {

Diff for: TestFoundation/TestNSCompoundPredicate.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class TestNSCompoundPredicate: XCTestCase {
9292
var shortCircuited = true
9393

9494
let bOK = NSPredicate(value: false)
95-
let bDontEval = NSPredicate(block: { _ in
95+
let bDontEval = NSPredicate(block: { (_, _) in
9696
shortCircuited = false
9797
return true
9898
})
@@ -106,7 +106,7 @@ class TestNSCompoundPredicate: XCTestCase {
106106
var shortCircuited = true
107107

108108
let bOK = NSPredicate(value: true)
109-
let bDontEval = NSPredicate(block: { _ in
109+
let bDontEval = NSPredicate(block: { (_, _) in
110110
shortCircuited = false
111111
return true
112112
})

Diff for: TestFoundation/TestNSURLSession.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class TestURLSession : XCTestCase {
193193
let session = URLSession(configuration: URLSessionConfiguration.default,
194194
delegate: delegate, delegateQueue: nil)
195195
let completionExpectation = expectation(description: "dataTask completion block wasn't called")
196-
let task = session.dataTask(with: url) { _ in
196+
let task = session.dataTask(with: url) { (_, _, _) in
197197
completionExpectation.fulfill()
198198
}
199199
task.resume()
@@ -207,9 +207,8 @@ class TestURLSession : XCTestCase {
207207
delegate: nil,
208208
delegateQueue: nil)
209209
let completionExpectation = expectation(description: "dataTask completion block wasn't called")
210-
let task = session.dataTask(with: url) { result in
211-
let error = result.2 as? URLError
212-
210+
let task = session.dataTask(with: url) { (_, _, result) in
211+
let error = result as? URLError
213212
XCTAssertNotNil(error)
214213
XCTAssertEqual(error?.code, .badURL)
215214
completionExpectation.fulfill()

0 commit comments

Comments
 (0)