Skip to content

Commit 62390f6

Browse files
committed
Remove a warning from AlwaysUseLiteralForEmptyCollectionInit.
1 parent 7af3b10 commit 62390f6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Sources/SwiftFormat/Rules/AlwaysUseLiteralForEmptyCollectionInit.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ public final class AlwaysUseLiteralForEmptyCollectionInit : SyntaxFormatRule {
166166
}
167167

168168
private func getLiteralType(_ arrayLiteral: ArrayExprSyntax) -> TypeSyntax? {
169-
guard let elementExpr = arrayLiteral.elements.firstAndOnly,
170-
elementExpr.is(ArrayElementSyntax.self) else {
169+
guard arrayLiteral.elements.count == 1 else {
171170
return nil
172171
}
173172

0 commit comments

Comments
 (0)