@@ -20,7 +20,8 @@ public extension FormatRule {
2020        } 
2121
2222        formatter. forEach ( . keyword)  {  keywordIndex,  keyword in 
23-             guard  [ " func " ,  " init " ,  " subscript " ] . contains ( keyword. string) , 
23+             guard  case let  . keyword( keyword)  =  keyword, 
24+                   [ " func " ,  " init " ,  " subscript " ] . contains ( keyword) , 
2425                  let  functionDecl =  formatter. parseFunctionDeclaration ( keywordIndex:  keywordIndex) , 
2526                  functionDecl. effects. contains ( where:  {  $0. hasPrefix ( " async " )  } ) , 
2627                  let  bodyRange =  functionDecl. bodyRange
@@ -33,14 +34,9 @@ public extension FormatRule {
3334
3435            if  formatter. options. redundantAsync ==  . testsOnly { 
3536                // Only process test functions
36-                 guard  let  testFramework,  functionDecl. returnType ==  nil  else  {  return  } 
37- 
38-                 switch  testFramework { 
39-                 case  . xcTest: 
40-                     guard  functionDecl. name? . starts ( with:  " test " )  ==  true  else  {  return  } 
41-                 case  . swiftTesting: 
42-                     guard  formatter. modifiersForDeclaration ( at:  keywordIndex,  contains:  " @Test " )  else  {  return  } 
43-                 } 
37+                 guard  keyword ==  " func " ,  let  testFramework, 
38+                       formatter. isTestFunction ( at:  keywordIndex,  in:  functionDecl,  for:  testFramework) 
39+                 else  {  return  } 
4440            } 
4541
4642            // Check if the function body contains any await keywords
0 commit comments