Skip to content

Commit

Permalink
Update UseShorthandTypeNames.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
Azoy committed Nov 4, 2024
1 parent 9cbc942 commit e6aa9ec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/SwiftFormat/Rules/UseShorthandTypeNames.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {

switch node.name.text {
case "Array":
guard case .type(let typeArgument) = genericArgumentList.firstAndOnly.argument else {
guard case .type(let typeArgument) = genericArgumentList.firstAndOnly?.argument else {
newNode = nil
break
}
Expand Down Expand Up @@ -76,7 +76,7 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {
newNode = nil
break
}
guard case .type(let typeArgument) = genericArgumentList.firstAndOnly.argument else {
guard case .type(let typeArgument) = genericArgumentList.firstAndOnly?.argument else {
newNode = nil
break
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {

switch expression.baseName.text {
case "Array":
guard case .type(let typeArgument) = genericArgumentList.firstAndOnly.argument else {
guard case .type(let typeArgument) = genericArgumentList.firstAndOnly?.argument else {
newNode = nil
break
}
Expand Down Expand Up @@ -167,7 +167,7 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {
newNode = ExprSyntax(dictTypeExpr)

case "Optional":
guard case .type(let typeArgument) = genericArgumentList.firstAndOnly.argument else {
guard case .type(let typeArgument) = genericArgumentList.firstAndOnly?.argument else {
newNode = nil
break
}
Expand Down

0 comments on commit e6aa9ec

Please sign in to comment.