Skip to content

Commit 4bc9b27

Browse files
authored
Merge pull request #618 from Matejkob/fix-warnings
Remove unnecessary casting
2 parents 4bb5728 + 60306f8 commit 4bc9b27

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Sources/SwiftFormat/Rules/OmitExplicitReturns.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public final class OmitExplicitReturns: SyntaxFormatRule {
123123
}
124124

125125
private func containsSingleReturn(_ body: CodeBlockItemListSyntax) -> ReturnStmtSyntax? {
126-
guard let element = body.firstAndOnly?.as(CodeBlockItemSyntax.self),
126+
guard let element = body.firstAndOnly,
127127
let returnStmt = element.item.as(ReturnStmtSyntax.self) else
128128
{
129129
return nil

Sources/SwiftFormat/Rules/ReplaceForEachWithForLoop.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public final class ReplaceForEachWithForLoop : SyntaxLintRule {
2929
return .visitChildren
3030
}
3131

32-
guard let memberName = member.declName.baseName.as(TokenSyntax.self),
33-
memberName.text == "forEach" else {
32+
let memberName = member.declName.baseName
33+
guard memberName.text == "forEach" else {
3434
return .visitChildren
3535
}
3636

0 commit comments

Comments
 (0)