Skip to content

CAT 034

unurgunite edited this page Jul 11, 2026 · 3 revisions

CAT-034 — each_with_index.map → map_with_index

Severity: info | Confidence: high | Auto-fix:

Description

each_with_index.map → map_with_index — Use map_with_index instead of each_with_index + map for cleaner and more efficient code.

Bad code

ary.each_with_index.map { |x, i| ... }

Benchmark

Note

See bench results at bench/cat-034/

Clone this wiki locally