Skip to content

Commit ce8f70d

Browse files
committed
Cleanup: DiffableTextKit/Info.
1 parent 00096fa commit ce8f70d

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

Sources/DiffableTextKit/Support/Info.swift

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
/// An error message that contains a description in DEBUG mode.
1515
///
16-
/// - Uses conditional compilation.
16+
/// It uses conditional compilation such that it has no performance cost in RELEASE mode.
1717
///
1818
public struct Info: CustomStringConvertible, Error {
1919
@usableFromInline static let description = "[DEBUG]"
@@ -43,14 +43,9 @@ public struct Info: CustomStringConvertible, Error {
4343
// MARK: Initializers - Indirect
4444
//=------------------------------------------------------------------------=
4545

46-
@inlinable @inline(__always)
47-
public init(_ components: () -> [Component]) {
48-
self.init(description: components().lazy.map(\.content).joined(separator: " "))
49-
}
50-
5146
@inlinable @inline(__always)
5247
public init(_ components: @autoclosure () -> [Component]) {
53-
self.init(components)
48+
self.init(description: components().map(\.content).joined(separator: " "))
5449
}
5550

5651
//=------------------------------------------------------------------------=
@@ -68,14 +63,9 @@ public struct Info: CustomStringConvertible, Error {
6863
// MARK: Print - Indirect
6964
//=------------------------------------------------------------------------=
7065

71-
@inlinable @inline(__always)
72-
public static func print(_ components: () -> [Component]) {
73-
Self.print(String(describing: Info(components())))
74-
}
75-
7666
@inlinable @inline(__always)
7767
public static func print(_ components: @autoclosure () -> [Component]) {
78-
Self.print(String(describing: Info(components())))
68+
self.print(String(describing: Info(components())))
7969
}
8070

8171
//*========================================================================*
@@ -98,8 +88,8 @@ public struct Info: CustomStringConvertible, Error {
9888
self.content = content
9989
}
10090

101-
@inlinable public init(stringLiteral value: StringLiteralType) {
102-
self.content = value
91+
@inlinable public init(stringLiteral content: StringLiteralType) {
92+
self.content = content
10393
}
10494

10595
//=--------------------------------------------------------------------=
@@ -111,7 +101,7 @@ public struct Info: CustomStringConvertible, Error {
111101
}
112102

113103
@inlinable public static func mark(_ value: Any) -> Self {
114-
Self(content: "« \(String(describing: value)) »")
104+
Self(content: "« \(value) »")
115105
}
116106
}
117107
}

0 commit comments

Comments
 (0)