Skip to content

Commit e59c3a2

Browse files
committed
Foratting and preambles
1 parent 6a958fd commit e59c3a2

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

Sources/AsyncAlgorithms/AsyncMapErrorSequence.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
//===----------------------------------------------------------------------===//
22
//
3-
// This source file is part of the Swift.org open source project
3+
// This source file is part of the Swift Async Algorithms open source project
44
//
5-
// Copyright (c) 2024 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2022 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
9-
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
109
//
1110
//===----------------------------------------------------------------------===//
1211

@@ -21,7 +20,9 @@ extension AsyncSequence {
2120
///
2221
/// Use the ``mapError(_:)`` operator when you need to replace one error type with another.
2322
@available(AsyncAlgorithms 1.1, *)
24-
public func mapError<MappedError: Error>(_ transform: @Sendable @escaping (Failure) async -> MappedError) -> AsyncMapErrorSequence<Self, MappedError> {
23+
public func mapError<MappedError: Error>(
24+
_ transform: @Sendable @escaping (Failure) async -> MappedError
25+
) -> AsyncMapErrorSequence<Self, MappedError> {
2526
AsyncMapErrorSequence(base: self, transform: transform)
2627
}
2728
}
@@ -45,7 +46,7 @@ public struct AsyncMapErrorSequence<Base: AsyncSequence, MappedError: Error> {
4546
}
4647

4748
@available(AsyncAlgorithms 1.1, *)
48-
extension AsyncMapErrorSequence: AsyncSequence {
49+
extension AsyncMapErrorSequence: AsyncSequence {
4950

5051
/// The iterator that produces elements of the map sequence.
5152
public struct Iterator: AsyncIteratorProtocol {
@@ -85,8 +86,8 @@ extension AsyncMapErrorSequence: AsyncSequence {
8586
}
8687

8788
@available(AsyncAlgorithms 1.1, *)
88-
extension AsyncMapErrorSequence: Sendable where Base: Sendable { }
89+
extension AsyncMapErrorSequence: Sendable where Base: Sendable {}
8990

9091
@available(*, unavailable)
91-
extension AsyncMapErrorSequence.Iterator: Sendable { }
92+
extension AsyncMapErrorSequence.Iterator: Sendable {}
9293
#endif

Tests/AsyncAlgorithmsTests/TestMapError.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift Async Algorithms open source project
4+
//
5+
// Copyright (c) 2022 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
//
10+
//===----------------------------------------------------------------------===//
11+
112
import AsyncAlgorithms
213
import XCTest
314

@@ -36,7 +47,8 @@ final class TestMapError: XCTestCase {
3647
func test_mapError_cancellation() async throws {
3748
let value = "test"
3849
let source = Indefinite(value: value).async
39-
let sequence = source
50+
let sequence =
51+
source
4052
.map {
4153
if $0 == "just to trick compiler that this may throw" {
4254
throw MyAwesomeError.originalError
@@ -95,9 +107,9 @@ final class TestMapError: XCTestCase {
95107
}
96108

97109
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
98-
private extension TestMapError {
110+
extension TestMapError {
99111

100-
enum MyAwesomeError: Error {
112+
fileprivate enum MyAwesomeError: Error {
101113
case originalError
102114
case mappedError
103115
}

0 commit comments

Comments
 (0)