Skip to content

Commit

Permalink
Merge pull request #575 from ahoppen/ahoppen/syntax-collection-range-…
Browse files Browse the repository at this point in the history
…replaceable

Use `where` instead of filter for `for` loops
  • Loading branch information
ahoppen committed Aug 1, 2023
2 parents 825f3f0 + aff4e09 commit 243db9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {

// An if-configuration clause around a switch-case encloses the case's node, so an
// if-configuration clause requires a break here in order to be allowed on a new line.
for ifConfigDecl in node.cases.filter({ $0.is(IfConfigDeclSyntax.self) }) {
for ifConfigDecl in node.cases where ifConfigDecl.is(IfConfigDeclSyntax.self) {
if config.indentSwitchCaseLabels {
before(ifConfigDecl.firstToken(viewMode: .sourceAccurate), tokens: .break(.open))
after(ifConfigDecl.lastToken(viewMode: .sourceAccurate), tokens: .break(.close, size: 0))
Expand Down

0 comments on commit 243db9e

Please sign in to comment.