Skip to content

Commit 7463405

Browse files
committed
[Lint/Format] Rename AlwaysUseLiteralForEmptyArrayInit into AlwaysUseLiteralForEmptyCollectionInit
1 parent afaa91d commit 7463405

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Sources/SwiftFormat/Core/Pipelines+Generated.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class LintPipeline: SyntaxVisitor {
243243
}
244244

245245
override func visit(_ node: PatternBindingSyntax) -> SyntaxVisitorContinueKind {
246-
visitIfEnabled(AlwaysUseLiteralForEmptyArrayInit.visit, for: node)
246+
visitIfEnabled(AlwaysUseLiteralForEmptyCollectionInit.visit, for: node)
247247
visitIfEnabled(OmitExplicitReturns.visit, for: node)
248248
visitIfEnabled(UseSingleLinePropertyGetter.visit, for: node)
249249
return .visitChildren
@@ -357,7 +357,7 @@ extension FormatPipeline {
357357

358358
func rewrite(_ node: Syntax) -> Syntax {
359359
var node = node
360-
node = AlwaysUseLiteralForEmptyArrayInit(context: context).rewrite(node)
360+
node = AlwaysUseLiteralForEmptyCollectionInit(context: context).rewrite(node)
361361
node = DoNotUseSemicolons(context: context).rewrite(node)
362362
node = FileScopedDeclarationPrivacy(context: context).rewrite(node)
363363
node = FullyIndirectEnum(context: context).rewrite(node)

Sources/SwiftFormat/Core/RuleNameCache+Generated.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@_spi(Testing)
1717
public let ruleNameCache: [ObjectIdentifier: String] = [
1818
ObjectIdentifier(AllPublicDeclarationsHaveDocumentation.self): "AllPublicDeclarationsHaveDocumentation",
19-
ObjectIdentifier(AlwaysUseLiteralForEmptyArrayInit.self): "AlwaysUseLiteralForEmptyArrayInit",
19+
ObjectIdentifier(AlwaysUseLiteralForEmptyCollectionInit.self): "AlwaysUseLiteralForEmptyCollectionInit",
2020
ObjectIdentifier(AlwaysUseLowerCamelCase.self): "AlwaysUseLowerCamelCase",
2121
ObjectIdentifier(AmbiguousTrailingClosureOverload.self): "AmbiguousTrailingClosureOverload",
2222
ObjectIdentifier(BeginDocumentationCommentWithOneLineSummary.self): "BeginDocumentationCommentWithOneLineSummary",

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": false,
18+
"AlwaysUseLiteralForEmptyCollectionInit": false,
1919
"AlwaysUseLowerCamelCase": true,
2020
"AmbiguousTrailingClosureOverload": true,
2121
"BeginDocumentationCommentWithOneLineSummary": false,

Sources/SwiftFormat/Rules/AlwaysUseLiteralForEmptyArrayInit.swift renamed to Sources/SwiftFormat/Rules/AlwaysUseLiteralForEmptyCollectionInit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import SwiftParser
2121
/// Lint: Non-literal empty array initialization will yield a lint error.
2222
/// Format: All invalid use sites would be related with empty literal (with or without explicit type annotation).
2323
@_spi(Rules)
24-
public final class AlwaysUseLiteralForEmptyArrayInit : SyntaxFormatRule {
24+
public final class AlwaysUseLiteralForEmptyCollectionInit : SyntaxFormatRule {
2525
public override class var isOptIn: Bool { return true }
2626

2727
public override func visit(_ node: PatternBindingSyntax) -> PatternBindingSyntax {

Tests/SwiftFormatTests/Rules/AlwaysUseLiteralForEmptyArrayInitTests.swift renamed to Tests/SwiftFormatTests/Rules/AlwaysUseLiteralForEmptyCollectionInitTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import _SwiftFormatTestSupport
22

33
@_spi(Rules) import SwiftFormat
44

5-
final class AlwaysUseLiteralForEmptyArrayInitTests: LintOrFormatRuleTestCase {
5+
final class AlwaysUseLiteralForEmptyCollectionInitTests: LintOrFormatRuleTestCase {
66
func testArray() {
77
assertFormatting(
8-
AlwaysUseLiteralForEmptyArrayInit.self,
8+
AlwaysUseLiteralForEmptyCollectionInit.self,
99
input: """
1010
public struct Test {
1111
var value1 = 1️⃣[Int]()
@@ -48,7 +48,7 @@ final class AlwaysUseLiteralForEmptyArrayInitTests: LintOrFormatRuleTestCase {
4848

4949
func testDictionary() {
5050
assertFormatting(
51-
AlwaysUseLiteralForEmptyArrayInit.self,
51+
AlwaysUseLiteralForEmptyCollectionInit.self,
5252
input: """
5353
public struct Test {
5454
var value1 = 1️⃣[Int: String]()

0 commit comments

Comments
 (0)