Skip to content

Commit

Permalink
Merge pull request #13 from MojtabaHs/chore/cleanup
Browse files Browse the repository at this point in the history
chore:‌ Cleanup some extra characters and reduce the code size a bit
  • Loading branch information
Mr-Alirezaa authored Feb 17, 2024
2 parents e818066 + b842bc9 commit 47ee863
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Sources/BuildableMacros/Foundation+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extension Collection where Element: Equatable {
func contains<C: Collection>(anyOf collection: C) -> Bool where C.Element == Element {
contains(where: collection.contains(_:))
contains(where: collection.contains)
}
}
2 changes: 1 addition & 1 deletion Sources/BuildableMacros/GeneralDiagnostic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension GeneralDiagnostic: DiagnosticMessage {
var message: String {
switch self {
case let .unknownLiteralExpr(expectedType):
"Expression is unknown. Value for the argument must be a literal of type \"\(String(describing: expectedType))\""
"Expression is unknown. Value for the argument must be a literal of type \"\(expectedType)\""
}
}

Expand Down
14 changes: 6 additions & 8 deletions Sources/BuildableMacros/SwiftSyntax+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ 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 {
return false
}
} else {
return false
} 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 47ee863

Please sign in to comment.