Skip to content

Commit 35db859

Browse files
eregonbyroot
authored andcommitted
Avoid extra String#+@ calls, interpolated strings are already mutable
1 parent d0b47b0 commit 35db859

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/json/truffle_ruby/generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def json_transform(state)
521521
end
522522

523523
delim = ",#{state.object_nl}"
524-
result = +"{#{state.object_nl}"
524+
result = "{#{state.object_nl}"
525525
first = true
526526
key_type = nil
527527
indent = !state.object_nl.empty?
@@ -558,7 +558,7 @@ def json_transform(state)
558558
raise TypeError, "#{key.class}#to_s returns an instance of #{key_str.class}, expected a String"
559559
end
560560

561-
result = +"#{result}#{key_json}#{state.space_before}:#{state.space}"
561+
result = "#{result}#{key_json}#{state.space_before}:#{state.space}"
562562
if state.strict? && !Generator.native_type?(value)
563563
if state.as_json
564564
value = state.as_json.call(value, false)

0 commit comments

Comments
 (0)