Skip to content

Commit

Permalink
Run swift-format
Browse files Browse the repository at this point in the history
  • Loading branch information
stephencelis authored and github-actions[bot] committed Apr 4, 2024
1 parent f88b07c commit 167e2ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/CasePathsMacros/CasePathableMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@ extension CasePathableMacro: MemberMacro {
let leadingTriviaLines = decl.leadingTrivia.description
.drop(while: \.isNewline)
.split(separator: "\n", omittingEmptySubsequences: false)
let indent = leadingTriviaLines
let indent =
leadingTriviaLines
.compactMap { $0.isEmpty ? nil : $0.prefix(while: \.isWhitespace).count }
.min(by: { (lhs: Int, rhs: Int) -> Bool in lhs == 0 ? lhs > rhs : lhs < rhs })
?? 0
let leadingTrivia = leadingTriviaLines
let leadingTrivia =
leadingTriviaLines
.map { String($0.dropFirst(indent)) }
.joined(separator: "\n")
return """
Expand Down

0 comments on commit 167e2ff

Please sign in to comment.