Skip to content

Commit c7d8018

Browse files
committed
Use new extension for attribute lookup
1 parent dca8bec commit c7d8018

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Sources/SwiftFormat/Core/SyntaxProtocol+Convenience.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,7 @@ extension SyntaxProtocol {
154154
var hasTestAncestor: Bool {
155155
var parent = self.parent
156156
while let existingParent = parent {
157-
if let functionDecl = existingParent.as(FunctionDeclSyntax.self),
158-
functionDecl.attributes.contains(where: {
159-
$0.as(AttributeSyntax.self)?.attributeName.as(IdentifierTypeSyntax.self)?.name.text == "Test"
160-
}) {
157+
if let functionDecl = existingParent.as(FunctionDeclSyntax.self), functionDecl.hasAttribute("Test") {
161158
return true
162159
}
163160
parent = existingParent.parent

0 commit comments

Comments
 (0)