-
Couldn't load subscription status.
- Fork 0
array_init
Ian Applebaum edited this page Jun 13, 2020
·
1 revision
Prefer using Array(seq) over seq.map { $0 } to convert a sequence into an Array.
- Identifier: array_init
- Enabled by default: Disabled
- Supports autocorrection: No
- Kind: lint
- Analyzer rule: No
- Minimum Swift compiler version: 3.0.0
- Default configuration: warning
Array(foo)foo.map { $0.0 }foo.map { $1 }foo.map { $0() }foo.map { ((), $0) }foo.map { $0! }foo.map { $0! /* force unwrap */ }foo.something { RouteMapper.map($0) }foo.map { !$0 }foo.map { /* a comment */ !$0 }↓foo.map({ $0 })↓foo.map { $0 }↓foo.map { return $0 }↓foo.map { elem in
elem
}↓foo.map { elem in
return elem
}↓foo.map { (elem: String) in
elem
}↓foo.map { elem -> String in
elem
}↓foo.map { $0 /* a comment */ }↓foo.map { /* a comment */ $0 }