Skip to content

Commit b9972b9

Browse files
authored
Merge pull request #234 from rxwei/remove-regex-init
2 parents 5a8c0cc + 3e3654e commit b9972b9

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

Sources/RegexBuilder/DSL.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension Regex {
1616
public init<Content: RegexComponent>(
1717
@RegexComponentBuilder _ content: () -> Content
1818
) where Content.Output == Output {
19-
self.init(content())
19+
self = content().regex
2020
}
2121
}
2222

Sources/_StringProcessing/Regex/Core.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,6 @@ public struct Regex<Output>: RegexComponent {
8181
self.init(ast: try! parseWithDelimiters(pattern))
8282
}
8383

84-
public init<Content: RegexComponent>(
85-
_ content: Content
86-
) where Content.Output == Output {
87-
self = content.regex
88-
}
89-
9084
public var regex: Regex<Output> {
9185
self
9286
}

Tests/RegexBuilderTests/RegexDSLTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RegexDSLTests: XCTestCase {
2222
line: UInt = #line,
2323
@RegexComponentBuilder _ content: () -> Content
2424
) throws {
25-
let regex = Regex(content())
25+
let regex = content()
2626
for (input, maybeExpectedCaptures) in tests {
2727
let maybeMatch = input.match(regex)
2828
if let expectedCaptures = maybeExpectedCaptures {

0 commit comments

Comments
 (0)