Skip to content

Commit

Permalink
Merge pull request #570 from kitasuke/fix-warning-by-applying-swift-s…
Browse files Browse the repository at this point in the history
…yntax-changes

Fix deprecated warnings regarding swift-syntax changes
  • Loading branch information
allevato committed Jul 24, 2023
2 parents 6aa70af + 3e451ef commit 8507216
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Sources/SwiftFormatRules/DoNotUseSemicolons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ public final class DoNotUseSemicolons: SyntaxFormatRule {
// 'while' statement.
if Syntax(item).as(CodeBlockItemSyntax.self)?
.children(viewMode: .sourceAccurate).first?.is(DoStmtSyntax.self) == true,
idx < node.count - 1
idx < node.count - 1,
let childrenIdx = node.index(of: item)
{
let children = node.children(viewMode: .sourceAccurate)
let nextItem = children[children.index(after: item.index)]
let nextItem = children[children.index(after: childrenIdx)]
if Syntax(nextItem).as(CodeBlockItemSyntax.self)?
.children(viewMode: .sourceAccurate).first?.is(WhileStmtSyntax.self) == true
{
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftFormatRules/UseWhereClausesInForLoops.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public final class UseWhereClausesInForLoops: SyntaxFormatRule {
return updateWithWhereCondition(
node: forInStmt,
condition: condition,
statements: forInStmt.body.statements.removingFirst()
statements: CodeBlockItemListSyntax(forInStmt.body.statements.dropFirst())
)

default:
Expand Down

0 comments on commit 8507216

Please sign in to comment.