Skip to content

Commit bdd3bf5

Browse files
stephencelisgithub-actions[bot]
authored andcommitted
Run swift-format
1 parent e39069d commit bdd3bf5

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

Sources/CasePaths/CasePathable.swift

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,20 @@ extension Case {
8181
// )
8282
// }
8383
// #else
84-
public subscript<AppendedValue>(
85-
dynamicMember keyPath: KeyPath<Value.AllCasePaths, AnyCasePath<Value, AppendedValue>>
86-
) -> Case<AppendedValue>
87-
where Value: CasePathable {
88-
@UncheckedSendable var keyPath = keyPath
89-
return Case<AppendedValue>(
90-
embed: { [$keyPath] in
91-
embed(Value.allCasePaths[keyPath: $keyPath.wrappedValue].embed($0))
92-
},
93-
extract: { [$keyPath] in
94-
extract(from: $0).flatMap(Value.allCasePaths[keyPath: $keyPath.wrappedValue].extract)
95-
}
96-
)
97-
}
84+
public subscript<AppendedValue>(
85+
dynamicMember keyPath: KeyPath<Value.AllCasePaths, AnyCasePath<Value, AppendedValue>>
86+
) -> Case<AppendedValue>
87+
where Value: CasePathable {
88+
@UncheckedSendable var keyPath = keyPath
89+
return Case<AppendedValue>(
90+
embed: { [$keyPath] in
91+
embed(Value.allCasePaths[keyPath: $keyPath.wrappedValue].embed($0))
92+
},
93+
extract: { [$keyPath] in
94+
extract(from: $0).flatMap(Value.allCasePaths[keyPath: $keyPath.wrappedValue].extract)
95+
}
96+
)
97+
}
9898
// #endif
9999

100100
public func embed(_ value: Value) -> Any {
@@ -532,26 +532,26 @@ extension AnyCasePath where Value: CasePathable {
532532
// )
533533
// }
534534
// #else
535-
/// Returns a new case path created by appending the case path at the given key path to this one.
536-
///
537-
/// This subscript is automatically invoked by case key path expressions via dynamic member
538-
/// lookup, and should not be invoked directly.
539-
///
540-
/// - Parameter keyPath: A key path to a case-pathable case path.
541-
public subscript<AppendedValue>(
542-
dynamicMember keyPath: KeyPath<Value.AllCasePaths, AnyCasePath<Value, AppendedValue>>
543-
) -> AnyCasePath<Root, AppendedValue> {
544-
@UncheckedSendable var keyPath = keyPath
545-
return AnyCasePath<Root, AppendedValue>(
546-
embed: { [$keyPath] in
547-
embed(Value.allCasePaths[keyPath: $keyPath.wrappedValue].embed($0))
548-
},
549-
extract: { [$keyPath] in
550-
extract(from: $0).flatMap(
551-
Value.allCasePaths[keyPath: $keyPath.wrappedValue].extract(from:)
552-
)
553-
}
554-
)
555-
}
535+
/// Returns a new case path created by appending the case path at the given key path to this one.
536+
///
537+
/// This subscript is automatically invoked by case key path expressions via dynamic member
538+
/// lookup, and should not be invoked directly.
539+
///
540+
/// - Parameter keyPath: A key path to a case-pathable case path.
541+
public subscript<AppendedValue>(
542+
dynamicMember keyPath: KeyPath<Value.AllCasePaths, AnyCasePath<Value, AppendedValue>>
543+
) -> AnyCasePath<Root, AppendedValue> {
544+
@UncheckedSendable var keyPath = keyPath
545+
return AnyCasePath<Root, AppendedValue>(
546+
embed: { [$keyPath] in
547+
embed(Value.allCasePaths[keyPath: $keyPath.wrappedValue].embed($0))
548+
},
549+
extract: { [$keyPath] in
550+
extract(from: $0).flatMap(
551+
Value.allCasePaths[keyPath: $keyPath.wrappedValue].extract(from:)
552+
)
553+
}
554+
)
555+
}
556556
// #endif
557557
}

Sources/CasePaths/Optional+CasePathable.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ extension Case {
6767
// self[dynamicMember: keyPath].some
6868
// }
6969
// #else
70-
/// A case path to the presence of a nested value.
71-
///
72-
/// This subscript can chain into an optional's wrapped value without explicitly specifying each
73-
/// `some` component.
74-
@_disfavoredOverload
75-
public subscript<Member>(
76-
dynamicMember keyPath: KeyPath<Value.AllCasePaths, AnyCasePath<Value, Member?>>
77-
) -> Case<Member>
78-
where Value: CasePathable {
79-
self[dynamicMember: keyPath].some
80-
}
70+
/// A case path to the presence of a nested value.
71+
///
72+
/// This subscript can chain into an optional's wrapped value without explicitly specifying each
73+
/// `some` component.
74+
@_disfavoredOverload
75+
public subscript<Member>(
76+
dynamicMember keyPath: KeyPath<Value.AllCasePaths, AnyCasePath<Value, Member?>>
77+
) -> Case<Member>
78+
where Value: CasePathable {
79+
self[dynamicMember: keyPath].some
80+
}
8181
// #endif
8282
}
8383

0 commit comments

Comments
 (0)