Skip to content

warning: literal string will be frozen in the future in ruby 3.4.0-preview2 #136

Open
@tmimura39

Description

@tmimura39

Warning by https://bugs.ruby-lang.org/issues/20205

# bundle exec rake minitest
Run options: --seed 23847

# Running:

/ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
...../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
./ruby-http-client/lib/ruby_http_client.rb:156: warning: literal string will be frozen in the future
./ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
/ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
/ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
....../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.../ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
.F./ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future
./ruby-http-client/lib/ruby_http_client.rb:143: warning: literal string will be frozen in the future

The choices are these

  • Use ''.dup or String.new('') or +''.
  • Magic comment frozen_string_literal: false like Shopify/httpclient.
  • Ignore warnings until Ruby v3.4 policy is finalized.
  • and other...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions