Skip to content

Commit 8f356ef

Browse files
stephencelisgithub-actions[bot]
authored andcommitted
Run swift-format
1 parent 9b5a510 commit 8f356ef

File tree

5 files changed

+50
-44
lines changed

5 files changed

+50
-44
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let package = Package(
1414
.library(
1515
name: "ComposableArchitecture",
1616
targets: ["ComposableArchitecture"]
17-
),
17+
)
1818
],
1919
dependencies: [
2020
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),

Sources/ComposableArchitecture/Effect.swift

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -506,29 +506,31 @@ extension EffectPublisher {
506506
return .init(
507507
operation: .publisher(
508508
publisher
509-
.map(withEscapedDependencies { escaped in
510-
{ action in
511-
escaped.yield {
512-
transform(action)
509+
.map(
510+
withEscapedDependencies { escaped in
511+
{ action in
512+
escaped.yield {
513+
transform(action)
514+
}
513515
}
514516
}
515-
})
517+
)
516518
.eraseToAnyPublisher()
517519
)
518520
)
519521
case let .run(priority, operation):
520522
return withEscapedDependencies { escaped in
521-
.init(
522-
operation: .run(priority) { send in
523-
await escaped.yield {
524-
await operation(
525-
Send { action in
526-
send(transform(action))
527-
}
528-
)
529-
}
523+
.init(
524+
operation: .run(priority) { send in
525+
await escaped.yield {
526+
await operation(
527+
Send { action in
528+
send(transform(action))
529+
}
530+
)
530531
}
531-
)
532+
}
533+
)
532534
}
533535
}
534536
}

Sources/ComposableArchitecture/Effects/Publisher.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,16 @@ extension Publisher {
394394
public func eraseToEffect<T>(
395395
_ transform: @escaping (Output) -> T
396396
) -> EffectPublisher<T, Failure> {
397-
self.map(withEscapedDependencies { escaped in
398-
{ action in
399-
escaped.yield {
400-
transform(action)
397+
self.map(
398+
withEscapedDependencies { escaped in
399+
{ action in
400+
escaped.yield {
401+
transform(action)
402+
}
401403
}
402404
}
403-
})
404-
.eraseToEffect()
405+
)
406+
.eraseToEffect()
405407
}
406408

407409
/// Turns any publisher into an ``EffectTask`` that cannot fail by wrapping its output and failure
@@ -474,13 +476,15 @@ extension Publisher {
474476
) -> EffectTask<T> {
475477
return
476478
self
477-
.map(withEscapedDependencies { escaped in
478-
{ action in
479-
escaped.yield {
480-
transform(.success(action))
479+
.map(
480+
withEscapedDependencies { escaped in
481+
{ action in
482+
escaped.yield {
483+
transform(.success(action))
484+
}
481485
}
482486
}
483-
})
487+
)
484488
.catch { Just(transform(.failure($0))) }
485489
.eraseToEffect()
486490
}

Sources/swift-composable-architecture-benchmark/Dependencies.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ import Dependencies
55
import Foundation
66

77
let dependenciesSuite = BenchmarkSuite(name: "Dependencies") { suite in
8-
#if swift(>=5.7)
9-
let reducer: some ReducerProtocol<Int, Void> = BenchmarkReducer()
10-
.dependency(\.calendar, .autoupdatingCurrent)
11-
.dependency(\.date, .init { Date() })
12-
.dependency(\.locale, .autoupdatingCurrent)
13-
.dependency(\.mainQueue, .immediate)
14-
.dependency(\.mainRunLoop, .immediate)
15-
.dependency(\.timeZone, .autoupdatingCurrent)
16-
.dependency(\.uuid, .init { UUID() })
8+
#if swift(>=5.7)
9+
let reducer: some ReducerProtocol<Int, Void> = BenchmarkReducer()
10+
.dependency(\.calendar, .autoupdatingCurrent)
11+
.dependency(\.date, .init { Date() })
12+
.dependency(\.locale, .autoupdatingCurrent)
13+
.dependency(\.mainQueue, .immediate)
14+
.dependency(\.mainRunLoop, .immediate)
15+
.dependency(\.timeZone, .autoupdatingCurrent)
16+
.dependency(\.uuid, .init { UUID() })
1717

18-
suite.benchmark("Dependency key writing") {
19-
var state = 0
20-
_ = reducer.reduce(into: &state, action: ())
21-
precondition(state == 1)
22-
}
23-
#endif
18+
suite.benchmark("Dependency key writing") {
19+
var state = 0
20+
_ = reducer.reduce(into: &state, action: ())
21+
precondition(state == 1)
22+
}
23+
#endif
2424
}
2525

2626
private struct BenchmarkReducer: ReducerProtocol {

Tests/ComposableArchitectureTests/EffectTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Combine
2-
@_spi(Canary) @_spi(Internals) import ComposableArchitecture
2+
@_spi(Canary)@_spi(Internals) import ComposableArchitecture
33
import XCTest
44

55
@MainActor
@@ -347,7 +347,7 @@ final class EffectTests: XCTestCase {
347347
.sink { output = $0 }
348348
.store(in: &self.cancellables)
349349
XCTAssertEqual(output, Date(timeIntervalSince1970: 1_234_567_890))
350-
350+
351351
if #available(iOS 15, macOS 12, tvOS 15, watchOS 8, *) {
352352
let effect = withDependencies {
353353
$0.date.now = Date(timeIntervalSince1970: 1_234_567_890)

0 commit comments

Comments
 (0)