class RuboCop::Cop::Lint::RedundantWithIndex

def autocorrect(node)

def autocorrect(node)
  lambda do |corrector|
    redundant_with_index?(node) do |send|
      if send.method_name == :each_with_index
        corrector.replace(send.loc.selector, 'each')
      else
        corrector.remove(with_index_range(send))
        corrector.remove(send.loc.dot)
      end
    end
  end
end