Skip to content

Commit 5df0dd2

Browse files
xedinallevato
authored andcommitted
OmitExplicitReturns: Rename unwrapReturnStmt into rewrapReturnedExpression
1 parent 9ab9151 commit 5df0dd2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/SwiftFormat/Rules/OmitExplicitReturns.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public final class OmitExplicitReturns: SyntaxFormatRule {
3232
return decl
3333
}
3434

35-
funcDecl.body?.statements = unwrapReturnStmt(returnStmt)
35+
funcDecl.body?.statements = rewrapReturnedExpression(returnStmt)
3636
diagnose(.omitReturnStatement, on: returnStmt, severity: .refactoring)
3737
return DeclSyntax(funcDecl)
3838
}
@@ -73,7 +73,7 @@ public final class OmitExplicitReturns: SyntaxFormatRule {
7373
return expr
7474
}
7575

76-
closureExpr.statements = unwrapReturnStmt(returnStmt)
76+
closureExpr.statements = rewrapReturnedExpression(returnStmt)
7777
diagnose(.omitReturnStatement, on: returnStmt, severity: .refactoring)
7878
return ExprSyntax(closureExpr)
7979
}
@@ -100,7 +100,7 @@ public final class OmitExplicitReturns: SyntaxFormatRule {
100100
return nil
101101
}
102102

103-
getter.body?.statements = unwrapReturnStmt(returnStmt)
103+
getter.body?.statements = rewrapReturnedExpression(returnStmt)
104104

105105
diagnose(.omitReturnStatement, on: returnStmt, severity: .refactoring)
106106

@@ -116,7 +116,7 @@ public final class OmitExplicitReturns: SyntaxFormatRule {
116116
diagnose(.omitReturnStatement, on: returnStmt, severity: .refactoring)
117117

118118
var newBlock = accessorBlock
119-
newBlock.accessors = .getter(unwrapReturnStmt(returnStmt))
119+
newBlock.accessors = .getter(rewrapReturnedExpression(returnStmt))
120120
return newBlock
121121
}
122122
}
@@ -131,7 +131,7 @@ public final class OmitExplicitReturns: SyntaxFormatRule {
131131
return !returnStmt.children(viewMode: .all).isEmpty && returnStmt.expression != nil ? returnStmt : nil
132132
}
133133

134-
private func unwrapReturnStmt(_ returnStmt: ReturnStmtSyntax) -> CodeBlockItemListSyntax {
134+
private func rewrapReturnedExpression(_ returnStmt: ReturnStmtSyntax) -> CodeBlockItemListSyntax {
135135
CodeBlockItemListSyntax([
136136
CodeBlockItemSyntax(
137137
leadingTrivia: returnStmt.leadingTrivia,

0 commit comments

Comments
 (0)