Skip to content

Commit e8937e0

Browse files
stephencelismluisbrown
authored andcommitted
Run swift-format
(cherry picked from commit 5f37642158c326e3cad08b8e9fba7570ade625b6) # Conflicts: # Tests/ComposableArchitectureTests/CompatibilityTests.swift
1 parent 7d59a0b commit e8937e0

20 files changed

+1264
-1260
lines changed

Sources/ComposableArchitecture/Debugging/ReducerDebugging.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,25 @@ extension Reducer {
115115

116116
@Sendable
117117
func print() {
118-
debugEnvironment.queue.async {
119-
var actionOutput = ""
120-
if actionFormat == .prettyPrint {
121-
customDump(debugAction, to: &actionOutput, indent: 2)
122-
} else {
123-
actionOutput.write(debugCaseOutput(debugAction).indent(by: 2))
124-
}
125-
let stateOutput =
126-
DebugState.self == Void.self
127-
? ""
128-
: diff(previousState, nextState).map { "\($0)\n" } ?? " (No state changes)\n"
129-
debugEnvironment.printer(
130-
"""
131-
\(prefix.isEmpty ? "" : "\(prefix): ")received action:
132-
\(actionOutput)
133-
\(stateOutput)
134-
"""
135-
)
118+
debugEnvironment.queue.async {
119+
var actionOutput = ""
120+
if actionFormat == .prettyPrint {
121+
customDump(debugAction, to: &actionOutput, indent: 2)
122+
} else {
123+
actionOutput.write(debugCaseOutput(debugAction).indent(by: 2))
136124
}
125+
let stateOutput =
126+
DebugState.self == Void.self
127+
? ""
128+
: diff(previousState, nextState).map { "\($0)\n" } ?? " (No state changes)\n"
129+
debugEnvironment.printer(
130+
"""
131+
\(prefix.isEmpty ? "" : "\(prefix): ")received action:
132+
\(actionOutput)
133+
\(stateOutput)
134+
"""
135+
)
136+
}
137137
}
138138

139139
switch effects.operation {

Sources/ComposableArchitecture/Debugging/ReducerInstrumentation.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@
7979
os_signpost(.end, log: log, name: "Effect", signpostID: sid, "%sFinished", prefix)
8080
},
8181
disposed: {
82-
os_signpost(.end, log: log, name: "Effect", signpostID: sid, "%sCancelled", prefix)
82+
os_signpost(
83+
.end, log: log, name: "Effect", signpostID: sid, "%sCancelled", prefix)
8384
},
8485
value: { value in
8586
os_signpost(
86-
.event, log: log, name: "Effect Output", "%sOutput from %s", prefix, actionOutput
87+
.event, log: log, name: "Effect Output", "%sOutput from %s", prefix,
88+
actionOutput
8789
)
8890
}
8991
)

Sources/ComposableArchitecture/Effect.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ extension Effect where Failure == Never {
158158
}
159159
}
160160
)
161-
}
161+
}
162162

163163
/// Wraps an asynchronous unit of work that can emit any number of times in an effect.
164164
///
@@ -368,7 +368,7 @@ extension Effect {
368368
case (.none, _):
369369
return other
370370
case (.producer, .producer), (.run, .producer), (.producer, .run):
371-
return Self(operation: .producer(.merge(self.producer, other.producer)))
371+
return Self(operation: .producer(.merge(self.producer, other.producer)))
372372
case let (.run(lhsPriority, lhsOperation), .run(rhsPriority, rhsOperation)):
373373
return Self(
374374
operation: .run { send in
@@ -422,7 +422,7 @@ extension Effect {
422422
case (.producer, .producer), (.run, .producer), (.producer, .run):
423423
return Self(
424424
operation: .producer(
425-
SignalProducer.concatenate(self.producer, other.producer)
425+
SignalProducer.concatenate(self.producer, other.producer)
426426
)
427427
)
428428
case let (.run(lhsPriority, lhsOperation), .run(rhsPriority, rhsOperation)):

Sources/ComposableArchitecture/Effects/Cancellation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extension Effect {
5858
let values = Atomic<[Output]>([])
5959
var isCaching = true
6060
let disposable =
61-
producer
61+
producer
6262
.on(value: { value in
6363
guard isCaching else { return }
6464
values.modify { $0.append(value) }

Sources/ComposableArchitecture/Effects/SignalProducer.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ extension Effect {
6060
watchOS, deprecated: 9999.0,
6161
message: "Iterate over 'SignalProducer.values' in an 'Effect.run', instead."
6262
)
63-
public init<P: SignalProducerConvertible>(_ producer: P) where P.Value == Output, P.Error == Failure {
63+
public init<P: SignalProducerConvertible>(_ producer: P)
64+
where P.Value == Output, P.Error == Failure {
6465
self.operation = .producer(producer.producer)
6566
}
6667

@@ -525,7 +526,7 @@ extension SignalProducer {
525526
outputType: NewValue.Type = NewValue.self,
526527
failureType: NewError.Type = NewError.self
527528
) -> Effect<NewValue, NewError> {
528-
self
529+
self
529530
.flatMapError { _ in .empty }
530531
.flatMap(.latest) { _ in .empty }
531532
.eraseToEffect()

Sources/ComposableArchitecture/Effects/Throttling.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extension Effect {
5151
return SignalProducer(value: value)
5252
.delay(
5353
throttleTime.addingTimeInterval(interval).timeIntervalSince1970
54-
- scheduler.currentDate.timeIntervalSince1970,
54+
- scheduler.currentDate.timeIntervalSince1970,
5555
on: scheduler
5656
).on(
5757
value: { _ in

Sources/ComposableArchitecture/Internal/Deprecations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ extension Effect where Failure == Error {
460460
observer.send(error: error)
461461
}
462462
}
463-
}
463+
}
464464

465465
return producer.on(disposed: task?.cancel)
466466
}
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
#if canImport(_Concurrency) && compiler(>=5.5.2)
2-
extension Task where Failure == Error {
3-
var cancellableValue: Success {
4-
get async throws {
5-
try await withTaskCancellationHandler {
6-
self.cancel()
7-
} operation: {
8-
try await self.value
2+
extension Task where Failure == Error {
3+
var cancellableValue: Success {
4+
get async throws {
5+
try await withTaskCancellationHandler {
6+
self.cancel()
7+
} operation: {
8+
try await self.value
9+
}
910
}
1011
}
1112
}
12-
}
1313

14-
extension Task where Failure == Never {
15-
@usableFromInline
16-
var cancellableValue: Success {
17-
get async {
18-
await withTaskCancellationHandler {
19-
self.cancel()
20-
} operation: {
21-
await self.value
14+
extension Task where Failure == Never {
15+
@usableFromInline
16+
var cancellableValue: Success {
17+
get async {
18+
await withTaskCancellationHandler {
19+
self.cancel()
20+
} operation: {
21+
await self.value
22+
}
2223
}
2324
}
2425
}
25-
}
2626
#endif

Sources/ComposableArchitecture/Store.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,24 +374,24 @@ public final class Store<State, Action> {
374374
}
375375
},
376376
completed: { [weak self] in
377-
self?.threadCheck(status: .effectCompletion(action))
378-
boxedTask.wrappedValue?.cancel()
379-
didComplete = true
377+
self?.threadCheck(status: .effectCompletion(action))
378+
boxedTask.wrappedValue?.cancel()
379+
didComplete = true
380380
self?.effectDisposables.removeValue(forKey: uuid)?.dispose()
381-
},
381+
},
382382
interrupted: { [weak self] in
383383
boxedTask.wrappedValue?.cancel()
384384
didComplete = true
385385
self?.effectDisposables.removeValue(forKey: uuid)?.dispose()
386-
}
386+
}
387387
)
388388

389389
let effectDisposable = CompositeDisposable()
390390
effectDisposable += producer.start(observer)
391391
effectDisposable += AnyDisposable { [weak self] in
392392
self?.threadCheck(status: .effectCompletion(action))
393393
self?.effectDisposables.removeValue(forKey: uuid)?.dispose()
394-
}
394+
}
395395

396396
if !didComplete {
397397
let task = Task<Void, Never> { @MainActor in

0 commit comments

Comments
 (0)