Skip to content

Commit cef2c6e

Browse files
committed
Make AlwaysUseLiteralForEmptyArrayInit rule opt-in and disabled by default
1 parent 5a48d08 commit cef2c6e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Sources/SwiftFormat/Core/RuleRegistry+Generated.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@_spi(Internal) public enum RuleRegistry {
1616
public static let rules: [String: Bool] = [
1717
"AllPublicDeclarationsHaveDocumentation": false,
18-
"AlwaysUseLiteralForEmptyArrayInit": true,
18+
"AlwaysUseLiteralForEmptyArrayInit": false,
1919
"AlwaysUseLowerCamelCase": true,
2020
"AmbiguousTrailingClosureOverload": true,
2121
"BeginDocumentationCommentWithOneLineSummary": false,

Sources/SwiftFormat/Rules/AlwaysUseLiteralForEmptyArrayInit.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import SwiftParser
2222
/// Format: All invalid use sites would be related with empty literal (with or without explicit type annotation).
2323
@_spi(Rules)
2424
public final class AlwaysUseLiteralForEmptyArrayInit : SyntaxFormatRule {
25+
public override class var isOptIn: Bool { return true }
26+
2527
public override func visit(_ node: PatternBindingSyntax) -> PatternBindingSyntax {
2628
guard let initializer = node.initializer else {
2729
return node

0 commit comments

Comments
 (0)