Skip to content

Commit 6ebdff1

Browse files
committed
swift-format: Eliminate intermediate array in checkForUnrecognizedRules
1 parent 31916d4 commit 6ebdff1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/swift-format/Frontend/ConfigurationProvider.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ final class ConfigurationProvider {
4040
// emit them into the diagnosticsEngine as warnings.
4141
// That way they will be printed out, but we'll continue execution on the valid rules.
4242

43-
let invalidRules = configuration.rules.filter { !RuleRegistry.rules.keys.contains($0.key) }
44-
for rule in invalidRules {
45-
diagnosticsEngine.emitWarning("Configuration contains an unrecognized rule: \(rule.key)", location: nil)
43+
for (key, _) in configuration.rules {
44+
if RuleRegistry.rules.keys.contains(key) {
45+
continue
46+
}
47+
diagnosticsEngine.emitWarning("Configuration contains an unrecognized rule: \(key)", location: nil)
4648
}
4749
}
4850

0 commit comments

Comments
 (0)