Skip to content

Commit

Permalink
Double assignment is still needed to prevent an "unused variable" war…
Browse files Browse the repository at this point in the history
…ning

That warning is still raised on latest Ruby.
  • Loading branch information
kamipo authored and ioquatix committed Feb 10, 2020
1 parent 5c121dd commit f4c5645
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/rack/show_exceptions.rb
Expand Up @@ -63,12 +63,12 @@ def dump_exception(exception)
def pretty(env, exception)
req = Rack::Request.new(env)

# This double assignment is to prevent an "unused variable" warning on
# Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
# This double assignment is to prevent an "unused variable" warning.
# Yes, it is dumb, but I don't like Ruby yelling at me.
path = path = (req.script_name + req.path_info).squeeze("/")

# This double assignment is to prevent an "unused variable" warning on
# Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
# This double assignment is to prevent an "unused variable" warning.
# Yes, it is dumb, but I don't like Ruby yelling at me.
frames = frames = exception.backtrace.map { |line|
frame = OpenStruct.new
if line =~ /(.*?):(\d+)(:in `(.*)')?/
Expand Down
8 changes: 4 additions & 4 deletions lib/rack/show_status.rb
Expand Up @@ -23,14 +23,14 @@ def call(env)

# client or server error, or explicit message
if (status.to_i >= 400 && empty) || env[RACK_SHOWSTATUS_DETAIL]
# This double assignment is to prevent an "unused variable" warning on
# Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
# This double assignment is to prevent an "unused variable" warning.
# Yes, it is dumb, but I don't like Ruby yelling at me.
req = req = Rack::Request.new(env)

message = Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s

# This double assignment is to prevent an "unused variable" warning on
# Ruby 1.9.3. Yes, it is dumb, but I don't like Ruby yelling at me.
# This double assignment is to prevent an "unused variable" warning.
# Yes, it is dumb, but I don't like Ruby yelling at me.
detail = detail = env[RACK_SHOWSTATUS_DETAIL] || message

body = @template.result(binding)
Expand Down

0 comments on commit f4c5645

Please sign in to comment.