Skip to content
This repository was archived by the owner on Aug 29, 2022. It is now read-only.

Commit 418cb57

Browse files
committed
Stylistic autocorrection for Swift 4
1 parent c0febcd commit 418cb57

19 files changed

+30
-33
lines changed

Sources/Task/ExistentialTask.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ public final class Task<SuccessValue>: NSObject {
9696
extension Task: FutureProtocol {
9797
public typealias Value = Result
9898

99-
public func upon(_ queue: PreferredExecutor, execute body: @escaping(Result) -> ()) {
99+
public func upon(_ queue: PreferredExecutor, execute body: @escaping(Result) -> Void) {
100100
future.upon(queue, execute: body)
101101
}
102102

103-
public func upon(_ executor: Executor, execute body: @escaping(Result) -> ()) {
103+
public func upon(_ executor: Executor, execute body: @escaping(Result) -> Void) {
104104
future.upon(executor, execute: body)
105105
}
106106

Sources/Task/ResultPromise.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,3 @@ extension PromiseProtocol where Value: Either, Value.Right == Void {
3535
return succeed(with: ())
3636
}
3737
}
38-

Sources/Task/TaskProgress.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private final class ProxyProgress: Progress {
7171
return [ #keyPath(observee.userInfo) ]
7272
}
7373

74-
override var userInfo: [ProgressUserInfoKey : Any] {
74+
override var userInfo: [ProgressUserInfoKey: Any] {
7575
return observee.userInfo
7676
}
7777

@@ -136,7 +136,7 @@ private final class ProxyProgress: Progress {
136136
observee.removeObserver(self, forKeyPath: #keyPath(Progress.paused), context: Observation.pausedContext)
137137
}
138138

139-
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
139+
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) {
140140
guard let keyPath = keyPath, object != nil, bnr_atomic_bitmask_test(&state, State.ready.rawValue), let observer = observer, let newValue = change?[.newKey] else { return }
141141
switch context {
142142
case Observation.cancelledContext?:
@@ -318,4 +318,3 @@ extension Task {
318318
}
319319

320320
#endif
321-

Sources/Task/TaskRecovery.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension Task {
2222
public func recover(upon executor: PreferredExecutor, substituting substitution: @escaping(Error) throws -> SuccessValue) -> Task<SuccessValue> {
2323
return recover(upon: executor as Executor, substituting: substitution)
2424
}
25-
25+
2626
/// Returns a `Task` containing the result of mapping `substitution` over
2727
/// the failed task's error.
2828
///
@@ -57,7 +57,7 @@ extension Task {
5757
return Task<SuccessValue>(future: future, cancellation: cancel)
5858
#endif
5959
}
60-
60+
6161
/// Begins another task in the case of the failure of `self` by calling
6262
/// `restartTask` with the error.
6363
///
@@ -69,7 +69,7 @@ extension Task {
6969
public func fallback<NewTask: FutureProtocol>(upon executor: PreferredExecutor, to restartTask: @escaping(Error) -> NewTask) -> Task<SuccessValue> where NewTask.Value: Either, NewTask.Value.Left == Error, NewTask.Value.Right == SuccessValue {
7070
return fallback(upon: executor as Executor, to: restartTask)
7171
}
72-
72+
7373
/// Begins another task in the case of the failure of `self` by calling
7474
/// `restartTask` with the error.
7575
///
@@ -87,13 +87,13 @@ extension Task {
8787
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
8888
let progress = extendedProgress(byUnitCount: 1)
8989
#endif
90-
90+
9191
let future: Future<Result> = andThen(upon: executor) { (result) -> Task<SuccessValue> in
9292
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
9393
progress.becomeCurrent(withPendingUnitCount: 1)
9494
defer { progress.resignCurrent() }
9595
#endif
96-
96+
9797
do {
9898
let value = try result.extract()
9999
return Task(success: value)

Sources/Task/TaskResult.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,3 @@ extension Task.Result where SuccessValue == Void {
5555
}
5656

5757
}
58-

Tests/DeferredTests/ExistentialFutureTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ExistentialFutureTests: XCTestCase {
1616
("testAnyWaitWithTimeout", testAnyWaitWithTimeout),
1717
("testFilledAnyFutureUpon", testFilledAnyFutureUpon),
1818
("testUnfilledAnyUponCalledWhenFilled", testUnfilledAnyUponCalledWhenFilled),
19-
("testFillAndIsFilledPostcondition", testFillAndIsFilledPostcondition),
19+
("testFillAndIsFilledPostcondition", testFillAndIsFilledPostcondition)
2020
]
2121
}
2222

Tests/DeferredTests/FutureCustomExecutorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class FutureCustomExecutorTests: CustomExecutorTestCase {
1414
return [
1515
("testUpon", testUpon),
1616
("testMap", testMap),
17-
("testAndThen", testAndThen),
17+
("testAndThen", testAndThen)
1818
]
1919
}
2020

Tests/DeferredTests/FutureIgnoreTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FutureIgnoreTests: XCTestCase {
1313
static var allTests: [(String, (FutureIgnoreTests) -> () throws -> Void)] {
1414
return [
1515
("testWaitWithTimeout", testWaitWithTimeout),
16-
("testIgnoredUponCalledWhenFilled", testIgnoredUponCalledWhenFilled),
16+
("testIgnoredUponCalledWhenFilled", testIgnoredUponCalledWhenFilled)
1717
]
1818
}
1919

Tests/DeferredTests/FutureTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class FutureTests: XCTestCase {
2222
("testAnd", testAnd),
2323
("testAllFilled", testAllFilled),
2424
("testAllFilledEmptyCollection", testAllFilledEmptyCollection),
25-
("testFirstFilled", testFirstFilled),
25+
("testFirstFilled", testFirstFilled)
2626
]
2727
}
2828

Tests/DeferredTests/LockingTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class LockingTests: XCTestCase {
120120
for lock in allLocks {
121121
var x = UnsafeAtomicCounter()
122122

123-
let startReader: (Int) -> () = { i in
123+
let startReader: (Int) -> Void = { i in
124124
let expectation = self.expectation(description: "reader \(i)")
125125
self.queue.async {
126126
lock.withReadLock {
@@ -158,7 +158,7 @@ class LockingTests: XCTestCase {
158158
}
159159

160160
func measureReadsSingleThread(lock: Locking, iterations: Int, file: StaticString = #file, line: Int = #line) {
161-
let doNothing: () -> () = {}
161+
let doNothing: () -> Void = {}
162162
func body() {
163163
for _ in 0 ..< iterations {
164164
lock.withReadLock(doNothing)
@@ -173,7 +173,7 @@ class LockingTests: XCTestCase {
173173
}
174174

175175
func measureWritesSingleThread(lock: Locking, iterations: Int, file: StaticString = #file, line: Int = #line) {
176-
let doNothing: () -> () = {}
176+
let doNothing: () -> Void = {}
177177
func body() {
178178
for _ in 0 ..< iterations {
179179
lock.withWriteLock(doNothing)

0 commit comments

Comments
 (0)