Skip to content

Commit b9a54e9

Browse files
review: use 'some Sequence' instead of generics
1 parent 0382b11 commit b9a54e9

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

Sources/Markdown/Base/Document.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public extension Document {
6565
}
6666

6767
/// Create a document from a sequence of block markup elements.
68-
init<Children: Sequence>(_ children: Children) where Children.Element == BlockMarkup {
68+
init(_ children: some Sequence<BlockMarkup>) {
6969
self.init(children, inheritSourceRange: false)
7070
}
7171

72-
init<Children: Sequence>(_ children: Children, inheritSourceRange: Bool) where Children.Element == BlockMarkup {
72+
init(_ children: some Sequence<BlockMarkup>, inheritSourceRange: Bool) {
7373
let rawChildren = children.map { $0.raw.markup }
7474
let parsedRange = inheritSourceRange ? rawChildren.parsedRange : nil
7575
try! self.init(.document(parsedRange: parsedRange, rawChildren))

Sources/Markdown/Block Nodes/Block Container Blocks/BlockQuote.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public struct BlockQuote: BlockMarkup, BasicBlockContainer {
2929
public extension BlockQuote {
3030
// MARK: BasicBlockContainer
3131

32-
init<Children: Sequence>(_ children: Children) where Children.Element == BlockMarkup {
32+
init(_ children: some Sequence<BlockMarkup>) {
3333
self.init(children, inheritSourceRange: false)
3434
}
3535

36-
init<Children: Sequence>(_ children: Children, inheritSourceRange: Bool) where Children.Element == BlockMarkup {
36+
init(_ children: some Sequence<BlockMarkup>, inheritSourceRange: Bool) {
3737
let rawChildren = children.map { $0.raw.markup }
3838
let parsedRange = inheritSourceRange ? rawChildren.parsedRange : nil
3939
try! self.init(.blockQuote(parsedRange: parsedRange, rawChildren))

Sources/Markdown/Block Nodes/Block Container Blocks/CustomBlock.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public struct CustomBlock: BlockMarkup, BasicBlockContainer {
2929
// MARK: - Public API
3030

3131
public extension CustomBlock {
32-
init<Children: Sequence>(_ children: Children) where Children.Element == BlockMarkup {
32+
init(_ children: some Sequence<BlockMarkup>) {
3333
self.init(children, inheritSourceRange: false)
3434
}
3535

36-
init<Children: Sequence>(_ children: Children, inheritSourceRange: Bool) where Children.Element == BlockMarkup {
36+
init(_ children: some Sequence<BlockMarkup>, inheritSourceRange: Bool) {
3737
let rawChildren = children.map { $0.raw.markup }
3838
let parsedRange = inheritSourceRange ? rawChildren.parsedRange : nil
3939
try! self.init(.customBlock(parsedRange: parsedRange, rawChildren))

Sources/Markdown/Structural Restrictions/BasicBlockContainer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
/// A block element that can contain only other block elements and doesn't require any other information.
1212
public protocol BasicBlockContainer: BlockContainer {
1313
/// Create this element from a sequence of block markup elements.
14-
init<Children: Sequence>(_ children: Children) where Children.Element == BlockMarkup
14+
init(_ children: some Sequence<BlockMarkup>)
1515

1616
/// Create this element from a sequence of block markup elements, and optionally inherit the source range from those elements.
17-
init<Children: Sequence>(_ children: Children, inheritSourceRange: Bool) where Children.Element == BlockMarkup
17+
init(_ children: some Sequence<BlockMarkup>, inheritSourceRange: Bool)
1818
}
1919

2020
// MARK: - Public API
@@ -31,7 +31,7 @@ extension BasicBlockContainer {
3131
}
3232

3333
/// Default implementation of `init(_:inheritSourceRange:)` that discards the `inheritSourceRange` parameter.
34-
public init<Children: Sequence>(_ children: Children, inheritSourceRange: Bool) where Children.Element == BlockMarkup {
34+
public init(_ children: some Sequence<BlockMarkup>, inheritSourceRange: Bool) {
3535
self.init(children)
3636
}
3737
}

0 commit comments

Comments
 (0)