-
-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Expected behavior
Use [0, 2] instead of .chars[0, 2].join if anything.
Actual behavior
a.rb:1:7: C: [Correctable] Performance/RedundantStringChars: Use [0] instead of chars[0, 2].
'foo'.chars[0, 2].join
^^^^^^^^^^^Following the advice as given will produce invalid code.
(Issue was found while trying different techniques to make printf indent correctly for multibyte chars.)
Steps to reproduce the problem
'foo'.chars[0, 2].joinRuboCop version
ruby 2025-08-01 30a20bc16
rubocop 2025-10-04 a08091813
System Version: macOS 15.6 (24G84)
Model Identifier: MacBookAir10,1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working