Skip to content

Commit 9e0f249

Browse files
committed
NFC: Rename OmitReturns rule into OmitExplicitReturns
1 parent 4d54de3 commit 9e0f249

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

Sources/SwiftFormat/Core/Pipelines+Generated.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class LintPipeline: SyntaxVisitor {
6161
}
6262

6363
override func visit(_ node: ClosureExprSyntax) -> SyntaxVisitorContinueKind {
64-
visitIfEnabled(OmitReturns.visit, for: node)
64+
visitIfEnabled(OmitExplicitReturns.visit, for: node)
6565
return .visitChildren
6666
}
6767

@@ -151,7 +151,7 @@ class LintPipeline: SyntaxVisitor {
151151
visitIfEnabled(AlwaysUseLowerCamelCase.visit, for: node)
152152
visitIfEnabled(BeginDocumentationCommentWithOneLineSummary.visit, for: node)
153153
visitIfEnabled(NoLeadingUnderscores.visit, for: node)
154-
visitIfEnabled(OmitReturns.visit, for: node)
154+
visitIfEnabled(OmitExplicitReturns.visit, for: node)
155155
visitIfEnabled(UseTripleSlashForDocumentationComments.visit, for: node)
156156
visitIfEnabled(ValidateDocumentationComments.visit, for: node)
157157
return .visitChildren
@@ -232,7 +232,7 @@ class LintPipeline: SyntaxVisitor {
232232
}
233233

234234
override func visit(_ node: PatternBindingSyntax) -> SyntaxVisitorContinueKind {
235-
visitIfEnabled(OmitReturns.visit, for: node)
235+
visitIfEnabled(OmitExplicitReturns.visit, for: node)
236236
visitIfEnabled(UseSingleLinePropertyGetter.visit, for: node)
237237
return .visitChildren
238238
}
@@ -282,7 +282,7 @@ class LintPipeline: SyntaxVisitor {
282282
override func visit(_ node: SubscriptDeclSyntax) -> SyntaxVisitorContinueKind {
283283
visitIfEnabled(AllPublicDeclarationsHaveDocumentation.visit, for: node)
284284
visitIfEnabled(BeginDocumentationCommentWithOneLineSummary.visit, for: node)
285-
visitIfEnabled(OmitReturns.visit, for: node)
285+
visitIfEnabled(OmitExplicitReturns.visit, for: node)
286286
visitIfEnabled(UseTripleSlashForDocumentationComments.visit, for: node)
287287
return .visitChildren
288288
}
@@ -351,7 +351,7 @@ extension FormatPipeline {
351351
node = NoLabelsInCasePatterns(context: context).rewrite(node)
352352
node = NoParensAroundConditions(context: context).rewrite(node)
353353
node = NoVoidReturnOnFunctionSignature(context: context).rewrite(node)
354-
node = OmitReturns(context: context).rewrite(node)
354+
node = OmitExplicitReturns(context: context).rewrite(node)
355355
node = OneCasePerLine(context: context).rewrite(node)
356356
node = OneVariableDeclarationPerLine(context: context).rewrite(node)
357357
node = OrderedImports(context: context).rewrite(node)

Sources/SwiftFormat/Core/RuleNameCache+Generated.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public let ruleNameCache: [ObjectIdentifier: String] = [
3737
ObjectIdentifier(NoLeadingUnderscores.self): "NoLeadingUnderscores",
3838
ObjectIdentifier(NoParensAroundConditions.self): "NoParensAroundConditions",
3939
ObjectIdentifier(NoVoidReturnOnFunctionSignature.self): "NoVoidReturnOnFunctionSignature",
40-
ObjectIdentifier(OmitReturns.self): "OmitReturns",
40+
ObjectIdentifier(OmitExplicitReturns.self): "OmitExplicitReturns",
4141
ObjectIdentifier(OneCasePerLine.self): "OneCasePerLine",
4242
ObjectIdentifier(OneVariableDeclarationPerLine.self): "OneVariableDeclarationPerLine",
4343
ObjectIdentifier(OnlyOneTrailingClosureArgument.self): "OnlyOneTrailingClosureArgument",

Sources/SwiftFormat/Rules/OmitReturns.swift renamed to Sources/SwiftFormat/Rules/OmitExplicitReturns.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import SwiftSyntax
1919
/// Format: `func <name>() { return ... }` constructs will be replaced with
2020
/// equivalent `func <name>() { ... }` constructs.
2121
@_spi(Rules)
22-
public final class OmitReturns: SyntaxFormatRule {
22+
public final class OmitExplicitReturns: SyntaxFormatRule {
2323
public override class var isOptIn: Bool { return true }
2424

2525
public override func visit(_ node: FunctionDeclSyntax) -> DeclSyntax {

Sources/SwiftFormatConfiguration/RuleRegistry+Generated.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ enum RuleRegistry {
3636
"NoLeadingUnderscores": false,
3737
"NoParensAroundConditions": true,
3838
"NoVoidReturnOnFunctionSignature": true,
39-
"OmitReturns": false,
39+
"OmitExplicitReturns": false,
4040
"OneCasePerLine": true,
4141
"OneVariableDeclarationPerLine": true,
4242
"OnlyOneTrailingClosureArgument": true,

Tests/SwiftFormatTests/Rules/OmitReturnsTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import _SwiftFormatTestSupport
55
final class OmitReturnsTests: LintOrFormatRuleTestCase {
66
func testOmitReturnInFunction() {
77
assertFormatting(
8-
OmitReturns.self,
8+
OmitExplicitReturns.self,
99
input: """
1010
func test() -> Bool {
1111
1️⃣return false
@@ -23,7 +23,7 @@ final class OmitReturnsTests: LintOrFormatRuleTestCase {
2323

2424
func testOmitReturnInClosure() {
2525
assertFormatting(
26-
OmitReturns.self,
26+
OmitExplicitReturns.self,
2727
input: """
2828
vals.filter {
2929
1️⃣return $0.count == 1
@@ -41,7 +41,7 @@ final class OmitReturnsTests: LintOrFormatRuleTestCase {
4141

4242
func testOmitReturnInSubscript() {
4343
assertFormatting(
44-
OmitReturns.self,
44+
OmitExplicitReturns.self,
4545
input: """
4646
struct Test {
4747
subscript(x: Int) -> Bool {
@@ -82,7 +82,7 @@ final class OmitReturnsTests: LintOrFormatRuleTestCase {
8282

8383
func testOmitReturnInComputedVars() {
8484
assertFormatting(
85-
OmitReturns.self,
85+
OmitExplicitReturns.self,
8686
input: """
8787
var x: Int {
8888
1️⃣return 42

0 commit comments

Comments
 (0)