Skip to content

Commit

Permalink
refactor: merge nested `if's.
Browse files Browse the repository at this point in the history
  • Loading branch information
MojtabaHs committed Feb 16, 2024
1 parent e12975e commit b842bc9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Sources/BuildableMacros/SwiftSyntax+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ extension TypeSyntaxProtocol {
func requiresEscaping() -> Bool {
if self.is(FunctionTypeSyntax.self) {
return true
} else if let tuple = self.as(TupleTypeSyntax.self) {
if tuple.elements.count == 1, let type = tuple.elements.first?.type.as(TypeSyntax.self) {
return type.requiresEscaping()
}
} else if
let tuple = self.as(TupleTypeSyntax.self),
tuple.elements.count == 1,
let type = tuple.elements.first?.type.as(TypeSyntax.self) {
return type.requiresEscaping()
}
return false
}
Expand Down

0 comments on commit b842bc9

Please sign in to comment.