-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule Request: Prefer Array(foo)
over foo.map({ $0 })
#1271
Labels
rule-request
Requests for a new rules.
Comments
Hi there! Any suggestions on how to detect that Thanks!
|
@ornithocoder You could use It'd be interesting if this rule supported all these variations:
|
Cool, thanks @marcelofabri. |
Other cases to think about when implementing the rule: var a: Int?
let foo = a.map { $0 } let foo = zip(["a", "b", "c"], [1, 2, 3]).map { $0 } // Should trigger the rule
let foo = zip(["a", "b", "c"], [1, 2, 3]).map { $0.0 }
let foo = zip(["a", "b", "c"], [1, 2, 3]).map { $0.1 }
let foo = zip(["a", "b", "c"], [1, 2, 3]).map { $1 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clearer and lots of optimizations
The text was updated successfully, but these errors were encountered: