File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -74,10 +74,11 @@ public final class DoNotUseSemicolons: SyntaxFormatRule {
74
74
// 'while' statement.
75
75
if Syntax ( item) . as ( CodeBlockItemSyntax . self) ?
76
76
. children ( viewMode: . sourceAccurate) . first? . is ( DoStmtSyntax . self) == true ,
77
- idx < node. count - 1
77
+ idx < node. count - 1 ,
78
+ let childrenIdx = node. index ( of: item)
78
79
{
79
80
let children = node. children ( viewMode: . sourceAccurate)
80
- let nextItem = children [ children. index ( after: item . index ) ]
81
+ let nextItem = children [ children. index ( after: childrenIdx ) ]
81
82
if Syntax ( nextItem) . as ( CodeBlockItemSyntax . self) ?
82
83
. children ( viewMode: . sourceAccurate) . first? . is ( WhileStmtSyntax . self) == true
83
84
{
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ public final class UseWhereClausesInForLoops: SyntaxFormatRule {
85
85
return updateWithWhereCondition (
86
86
node: forInStmt,
87
87
condition: condition,
88
- statements: forInStmt. body. statements. removingFirst ( )
88
+ statements: CodeBlockItemListSyntax ( forInStmt. body. statements. dropFirst ( ) )
89
89
)
90
90
91
91
default :
You can’t perform that action at this time.
0 commit comments