Flat Map over Map Reduce
Prefer flatMap over map followed by reduce([], +)
- Identifier:
flatmap_over_map_reduce - Enabled by default: No
- Supports autocorrection: No
- Kind: performance
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning
Non Triggering Examples
let foo = bar.map { $0.count }.reduce(0, +)
let foo = bar.flatMap { $0.array }
Triggering Examples
let foo = ↓bar.map { $0.array }.reduce([], +)
View on GitHub
Install in Dash