Fix warning: assigned but unused variable

There are several places where varaibles are assigned but not used.
The variables can be replaced with _, or prepended with _ to avoid a warning.
In one case the variable was removed because it was at the end of the method.

Addresses the following warnings:

lib/google/api_client.rb:493: warning: assigned but unused variable - key
lib/google/api_client/batch.rb:168: warning: assigned but unused variable - callback
lib/google/api_client/batch.rb:227: warning: assigned but unused variable - base
lib/google/api_client/batch.rb:271: warning: assigned but unused variable - protocol
lib/google/api_client/batch.rb:271: warning: assigned but unused variable - reason
lib/google/api_client/request.rb:247: warning: assigned but unused variable - request_env
This commit is contained in:
Mike Moore 2015-03-25 17:03:20 -06:00
parent fb3fc4623f
commit 349c26fa8b
3 changed files with 25 additions and 25 deletions

View File

@ -490,7 +490,7 @@ module Google
else else
check_cached_certs = lambda do check_cached_certs = lambda do
valid = false valid = false
for key, cert in @certificates for _key, cert in @certificates
begin begin
self.authorization.decoded_id_token(cert.public_key) self.authorization.decoded_id_token(cert.public_key)
valid = true valid = true

View File

@ -165,7 +165,7 @@ module Google
if @calls.nil? || @calls.empty? if @calls.nil? || @calls.empty?
raise BatchError, 'Cannot make an empty batch request' raise BatchError, 'Cannot make an empty batch request'
end end
parts = @calls.map {|(call_id, call, callback)| serialize_call(call_id, call)} parts = @calls.map {|(call_id, call, _callback)| serialize_call(call_id, call)}
build_multipart(parts, 'multipart/mixed', BATCH_BOUNDARY) build_multipart(parts, 'multipart/mixed', BATCH_BOUNDARY)
super super
end end
@ -224,7 +224,7 @@ module Google
raise BatchError, 'Invalid value for Content-ID: "%s"' % header raise BatchError, 'Invalid value for Content-ID: "%s"' % header
end end
base, call_id = header[1...-1].split('+') _base, call_id = header[1...-1].split('+')
return Addressable::URI.unencode(call_id) return Addressable::URI.unencode(call_id)
end end
@ -268,7 +268,7 @@ module Google
def deserialize_call_response(call_response) def deserialize_call_response(call_response)
outer_headers, outer_body = split_headers_and_body(call_response) outer_headers, outer_body = split_headers_and_body(call_response)
status_line, payload = outer_body.split("\n", 2) status_line, payload = outer_body.split("\n", 2)
protocol, status, reason = status_line.split(' ', 3) _protocol, status, _reason = status_line.split(' ', 3)
headers, body = split_headers_and_body(payload) headers, body = split_headers_and_body(payload)
content_id = find_header('Content-ID', outer_headers) content_id = find_header('Content-ID', outer_headers)

View File

@ -244,7 +244,7 @@ module Google
) )
end end
request_env = http_request.to_env(connection) http_request.to_env(connection)
end end
## ##