Skip to content

Commit

Permalink
Use Range#join instead of generic Parser::Source::Range.new
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Feb 5, 2024
1 parent c07dcd2 commit 4230dc0
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/rubocop/cop/performance/regexp_match.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def match_gvar?(sym)
end

def correct_operator(corrector, recv, arg, oper = nil)
op_range = correction_range(recv, arg)
op_range = recv.source_range.end.join(arg.source_range.begin)

replace_with_match_predicate_method(corrector, recv, arg, op_range)

Expand All @@ -271,13 +271,6 @@ def swap_receiver_and_arg(corrector, recv, arg)
corrector.replace(recv, arg.source)
corrector.replace(arg, recv.source)
end

def correction_range(recv, arg)
buffer = processed_source.buffer
op_begin_pos = recv.source_range.end_pos
op_end_pos = arg.source_range.begin_pos
Parser::Source::Range.new(buffer, op_begin_pos, op_end_pos)
end
end
end
end
Expand Down

0 comments on commit 4230dc0

Please sign in to comment.