Skip to content

chore: Address warning: literal string will be frozen in the future #21647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion google-apis-core/lib/google/apis/core/composite_io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def initialize(*ios)
end

def read(length = nil, buf = nil)
buf = buf ? buf.replace('') : ''
buf = buf ? buf.replace('') : ''.dup

begin
io = @ios[@index]
Expand Down
2 changes: 1 addition & 1 deletion google-apis-core/lib/google/apis/core/download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def prepare!
@download_io = File.open(download_dest, 'wb')
@close_io_on_finish = true
else
@download_io = StringIO.new('', 'wb')
@download_io = StringIO.new(''.dup, 'wb')
@close_io_on_finish = false
end
super
Expand Down
6 changes: 3 additions & 3 deletions google-apis-core/lib/google/apis/core/http_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def success(result, &block)
# @yield [nil, err] if block given
# @raise [StandardError] if no block
def error(err, rethrow: false, &block)
logger.debug { sprintf('Error - %s', PP.pp(err, '')) }
logger.debug { sprintf('Error - %s', PP.pp(err, ''.dup)) }
if err.is_a?(HTTPClient::BadResponseError)
begin
res = err.res
Expand Down Expand Up @@ -385,15 +385,15 @@ class RedactingSingleLine < PP::SingleLine
end

def safe_pretty_representation obj
out = ""
out = "".dup
printer = RedactingPP.new out, 79
printer.guard_inspect_key { printer.pp obj }
printer.flush
out << "\n"
end

def safe_single_line_representation obj
out = ""
out = "".dup
printer = RedactingSingleLine.new out
printer.guard_inspect_key { printer.pp obj }
printer.flush
Expand Down
4 changes: 2 additions & 2 deletions google-apis-core/lib/google/apis/core/multipart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def initialize(value, header = {})
end

def to_io(boundary)
part = ''
part = ''.dup
part << "--#{boundary}\r\n"
part << "Content-Type: application/json\r\n"
@header.each do |(k, v)|
Expand Down Expand Up @@ -59,7 +59,7 @@ def initialize(io, header = {})
end

def to_io(boundary)
head = ''
head = ''.dup
head << "--#{boundary}\r\n"
@header.each do |(k, v)|
head << "#{k}: #{v}\r\n"
Expand Down
2 changes: 1 addition & 1 deletion google-apis-core/lib/google/apis/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def backtrace
end

def inspect
extra = ""
extra = "".dup
extra << " status_code: #{status_code.inspect}" unless status_code.nil?
extra << " header: #{header.inspect}" unless header.nil?
extra << " body: #{body.inspect}" unless body.nil?
Expand Down
Loading