Skip to content

Commit

Permalink
Treat compactMap as standard function (realm#5876)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyDanny authored Nov 29, 2024
1 parent 341a5a1 commit b22c2b5
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct PreferKeyPathRule: OptInRule {
Example("f.allSatisfy ↓{ (a: A) in a.b }"),
Example("f.first ↓{ (a b: A) in b.c }"),
Example("f.contains ↓{ $0.0.a }"),
Example("f.compactMap ↓{ $0.a.b.c.d }"),
Example("f.flatMap ↓{ $0.a.b }"),
Example("let f: (Int) -> Int = ↓{ $0.bigEndian }", configuration: extendedMode),
],
Expand Down Expand Up @@ -78,6 +79,8 @@ struct PreferKeyPathRule: OptInRule {
Example("f.first(where: \\.a)"),
Example("f.drop ↓{ element in element.a }"):
Example("f.drop(while: \\.a)"),
Example("f.compactMap ↓{ $0.a.b.c.d }"):
Example("f.compactMap(\\.a.b.c.d)"),
]
)
}
Expand Down Expand Up @@ -191,6 +194,7 @@ private extension ClosureExprSyntax {
private let argumentLabelByStandardFunction: [String: String?] = [
"allSatisfy": nil,
"contains": "where",
"compactMap": nil,
"drop": "while",
"filter": nil,
"first": "where",
Expand Down

0 comments on commit b22c2b5

Please sign in to comment.