Skip to content

Commit 97de86b

Browse files
committed
Use reverse_each instead of reverse.find
Saves an Array allocation, and since the block already has a `return` statement, `#each` works just as well as `#find`.
1 parent 32d07d6 commit 97de86b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rubocop/cop/mixin/surrounding_space.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def index_of_first_token(node)
2222

2323
def index_of_last_token(node)
2424
e = node.loc.expression.end
25-
(0...e.column).to_a.reverse.find do |c|
25+
(0...e.column).to_a.reverse_each do |c|
2626
ix = token_table[e.line][c]
2727
return ix if ix
2828
end

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy