Skip to content

Commit b482d82

Browse files
committed
Remove optional
1 parent 26b8ebe commit b482d82

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Tool/Sources/SuggestionModel/String+LineEnding.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public extension String {
77
/// will be in the end of the string.
88
///
99
/// For other situations, we can assume that they are "\n".
10-
var lineEnding: Character? {
10+
var lineEnding: Character {
1111
if let last, last.isNewline { return last }
1212
return "\n"
1313
}
@@ -17,7 +17,7 @@ public extension String {
1717
fast: Bool = true
1818
) -> [Substring] {
1919
if fast {
20-
let lineEndingInText = lineEnding ?? "\n"
20+
let lineEndingInText = lineEnding
2121
return split(
2222
separator: lineEndingInText,
2323
omittingEmptySubsequences: omittingEmptySubsequences
@@ -34,7 +34,7 @@ public extension String {
3434
proposedLineEnding: String? = nil,
3535
appendLineBreakToLastLine: Bool = false
3636
) -> [String] {
37-
let lineEndingInText = lineEnding ?? "\n"
37+
let lineEndingInText = lineEnding
3838
let lineEnding = proposedLineEnding ?? String(lineEndingInText)
3939
// Split on character for better performance.
4040
let lines = split(separator: lineEndingInText, omittingEmptySubsequences: false)

0 commit comments

Comments
 (0)