Skip to content

Commit 875deac

Browse files
Minor refactor
Signed-off-by: Karan <[email protected]>
1 parent 6b895e1 commit 875deac

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Sources/SwiftSyntax/Trivia+commentValue.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ extension Trivia {
6868
// because it won't have any indentation since it starts with /**
6969
let indentation = lines.dropFirst()
7070
.map { $0.prefix(while: { $0 == " " || $0 == "\t" }) }
71-
.reduce(nil as Substring?) { (acc: Substring?, element: Substring.SubSequence) in
72-
acc.map { commonPrefix($0, element) } ?? element
71+
.reduce(nil as Substring?) { (acc: Substring?, element: Substring) in
72+
guard let acc else {
73+
return element
74+
}
75+
return commonPrefix(acc, element)
7376
}
7477

7578
guard let firstLine = lines.first else {

0 commit comments

Comments
 (0)