diff --git a/lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb b/lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb index fffd9d342..124ef5a66 100644 --- a/lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb +++ b/lib/rubocop/ast/node_pattern/compiler/sequence_subcompiler.rb @@ -347,7 +347,7 @@ def use_index_from_end def compile_loop_advance(to = '+=1') # The `#{@cur_child_var} ||` is just to avoid unused variable warning "(#{@cur_child_var} = #{@seq_var}.children[#{@cur_index_var} #{to}]; " \ - "#{@cur_child_var} || true)" + "#{@cur_child_var} || true)" end def compile_loop(term) diff --git a/lib/rubocop/ast/node_pattern/parser.rb b/lib/rubocop/ast/node_pattern/parser.rb index db8f3d6c9..c1df451b7 100644 --- a/lib/rubocop/ast/node_pattern/parser.rb +++ b/lib/rubocop/ast/node_pattern/parser.rb @@ -52,7 +52,7 @@ def enforce_unary(node) detail = node.loc&.expression&.source || node.to_s raise NodePattern::Invalid, 'parse error, expected unary node pattern ' \ - "but got expression matching multiple elements: #{detail}" + "but got expression matching multiple elements: #{detail}" end # Overrides Racc::Parser's method: diff --git a/spec/rubocop/ast/node_pattern_spec.rb b/spec/rubocop/ast/node_pattern_spec.rb index a2a6638a3..af7181bef 100644 --- a/spec/rubocop/ast/node_pattern_spec.rb +++ b/spec/rubocop/ast/node_pattern_spec.rb @@ -945,7 +945,7 @@ def not_match_codes(*codes) context 'with complex nesting' do let(:pattern) do '{(send {$int $float} {$:inc $:dec}) ' \ - '[!nil {($_ sym $_) (send ($_ $_) :object_id)}]}' + '[!nil {($_ sym $_) (send ($_ $_) :object_id)}]}' end let(:ruby) { '10.object_id' } let(:captured_vals) { [:int, 10] }