Skip to content

Commit 8335b63

Browse files
committed
Enable UseLetInEveryBoundCaseVariable and update binding patterns.
1 parent 0db13de commit 8335b63

File tree

26 files changed

+71
-71
lines changed

26 files changed

+71
-71
lines changed

.swift-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"AmbiguousTrailingClosureOverload": false,
1313
"NoBlockComments": true,
1414
"OrderedImports": true,
15-
"UseLetInEveryBoundCaseVariable": false,
15+
"UseLetInEveryBoundCaseVariable": true,
1616
"UseSynthesizedInitializer": true
1717
}
1818
}

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparser/ParserTokenSpecSetFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ let parserTokenSpecSetFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
3939

4040
for layoutNode in SYNTAX_NODES.compactMap(\.layoutNode) {
4141
for child in layoutNode.children {
42-
if case let .token(choices, _, _) = child.kind, choices.count > 1 {
42+
if case .token(let choices, _, _) = child.kind, choices.count > 1 {
4343
try! ExtensionDeclSyntax("extension \(layoutNode.kind.syntaxType)") {
4444
try EnumDeclSyntax(
4545
"""

Examples/Sources/MacroExamples/Implementation/Accessor/EnvironmentValueMacro.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public struct EnvironmentValueMacro: AccessorMacro {
2020
in context: some MacroExpansionContext
2121
) throws -> [AccessorDeclSyntax] {
2222
guard
23-
case let .argumentList(arguments) = node.arguments,
23+
case .argumentList(let arguments) = node.arguments,
2424
let argument = arguments.first
2525
else { return [] }
2626

Examples/Sources/MacroExamples/Implementation/ComplexMacros/OptionSetMacro.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ public struct OptionSetMacro {
8484
) -> (StructDeclSyntax, EnumDeclSyntax, TypeSyntax)? {
8585
// Determine the name of the options enum.
8686
let optionsEnumName: String
87-
if case let .argumentList(arguments) = attribute.arguments,
87+
if case .argumentList(let arguments) = attribute.arguments,
8888
let optionEnumNameArg = arguments.first(labeled: optionsEnumNameArgumentLabel)
8989
{
9090
// We have a options name; make sure it is a string literal.
9191
guard let stringLiteral = optionEnumNameArg.expression.as(StringLiteralExprSyntax.self),
9292
stringLiteral.segments.count == 1,
93-
case let .stringSegment(optionsEnumNameString)? = stringLiteral.segments.first
93+
case .stringSegment(let optionsEnumNameString)? = stringLiteral.segments.first
9494
else {
9595
if emitDiagnostics {
9696
context.diagnose(

Examples/Sources/MacroExamples/Implementation/Expression/WarningMacro.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public enum WarningMacro: ExpressionMacro {
2525
let stringLiteral = firstElement.expression
2626
.as(StringLiteralExprSyntax.self),
2727
stringLiteral.segments.count == 1,
28-
case let .stringSegment(messageString)? = stringLiteral.segments.first
28+
case .stringSegment(let messageString)? = stringLiteral.segments.first
2929
else {
3030
throw CustomError.message("#myWarning macro requires a string literal")
3131
}

Examples/Sources/MacroExamples/Implementation/MemberAttribute/WrapStoredPropertiesMacro.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public struct WrapStoredPropertiesMacro: MemberAttributeMacro {
3636
return []
3737
}
3838

39-
guard case let .argumentList(arguments) = node.arguments,
39+
guard case .argumentList(let arguments) = node.arguments,
4040
let firstElement = arguments.first,
4141
let stringLiteral = firstElement.expression
4242
.as(StringLiteralExprSyntax.self),
4343
stringLiteral.segments.count == 1,
44-
case let .stringSegment(wrapperName)? = stringLiteral.segments.first
44+
case .stringSegment(let wrapperName)? = stringLiteral.segments.first
4545
else {
4646
throw CustomError.message("macro requires a string literal containing the name of an attribute")
4747
}

Examples/Sources/MacroExamples/Implementation/Peer/AddAsyncMacro.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public struct AddAsyncMacro: PeerMacro {
8989

9090
// Drop the @addAsync attribute from the new declaration.
9191
let newAttributeList = funcDecl.attributes.filter {
92-
guard case let .attribute(attribute) = $0,
92+
guard case .attribute(let attribute) = $0,
9393
let attributeType = attribute.attributeName.as(IdentifierTypeSyntax.self),
9494
let nodeType = node.attributeName.as(IdentifierTypeSyntax.self)
9595
else {

Examples/Sources/MacroExamples/Implementation/Peer/AddCompletionHandlerMacro.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public struct AddCompletionHandlerMacro: PeerMacro {
128128

129129
// Drop the @addCompletionHandler attribute from the new declaration.
130130
let newAttributeList = funcDecl.attributes.filter {
131-
guard case let .attribute(attribute) = $0,
131+
guard case .attribute(let attribute) = $0,
132132
let attributeType = attribute.attributeName.as(IdentifierTypeSyntax.self),
133133
let nodeType = node.attributeName.as(IdentifierTypeSyntax.self)
134134
else {

Sources/SwiftCompilerPluginMessageHandling/JSON/CodingUtilities.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ internal enum _CodingPathNode {
2626
switch self {
2727
case .root:
2828
return []
29-
case let .node(key, parent):
29+
case .node(let key, let parent):
3030
return parent.path + [key]
31-
case let .indexNode(index, parent):
31+
case .indexNode(let index, let parent):
3232
return parent.path + [_CodingKey(index: index)]
3333
}
3434
}
@@ -87,17 +87,17 @@ internal enum _CodingKey: CodingKey {
8787

8888
var stringValue: String {
8989
switch self {
90-
case let .string(str): return str
91-
case let .int(int): return "\(int)"
92-
case let .index(index): return "Index \(index)"
90+
case .string(let str): return str
91+
case .int(let int): return "\(int)"
92+
case .index(let index): return "Index \(index)"
9393
}
9494
}
9595

9696
var intValue: Int? {
9797
switch self {
9898
case .string: return nil
99-
case let .int(int): return int
100-
case let .index(index): return index
99+
case .int(let int): return int
100+
case .index(let index): return index
101101
}
102102
}
103103
}

Sources/SwiftCompilerPluginMessageHandling/LRUCache.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ public class LRUCache<Key: Hashable, Value> {
5656

5757
set {
5858
switch (table[key], newValue) {
59-
case let (nil, newValue?): // create.
59+
case (nil, let newValue?): // create.
6060
self.ensureCapacityForNewValue()
6161
let node = _Node(key: key, value: newValue)
6262
addToHead(node: node)
6363
table[key] = node
6464

65-
case let (node?, newValue?): // update.
65+
case (let node?, let newValue?): // update.
6666
moveToHead(node: node)
6767
node.value = newValue
6868

69-
case let (node?, nil): // delete.
69+
case (let node?, nil): // delete.
7070
remove(node: node)
7171
table[key] = nil
7272

0 commit comments

Comments
 (0)