Skip to content

Commit 5057b66

Browse files
committed
Disallow optional Text usage in builder body
1 parent c175e8c commit 5057b66

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Sources/TextBuilder/TextBuilder.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public struct TextBuilderWith<Separator: TextBuilderSeparator> {
6161
}
6262

6363
@inlinable
64-
public static func buildExpression(_ component: Text?) -> Text? {
64+
public static func buildExpression(_ component: Text) -> Text? {
6565
component
6666
}
6767

@@ -109,12 +109,8 @@ public struct TextBuilderWith<Separator: TextBuilderSeparator> {
109109
}
110110

111111
@inlinable
112-
public static func buildExpression(_ text: Text?) -> [Text] {
113-
if let text = text {
114-
return [text]
115-
} else {
116-
return []
117-
}
112+
public static func buildExpression(_ text: Text) -> [Text] {
113+
[text]
118114
}
119115

120116
@inlinable

0 commit comments

Comments
 (0)