Permalink
Browse files

* lib/*.rb: Remove unused variable warnings.

  Patch by Run Paint [ruby-core:30991]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent cceca83 commit f3e35474078895e1d178e15cfbfc6743f9ffc62d @marcandre marcandre committed Nov 8, 2010
View
@@ -1,3 +1,10 @@
+Tue Nov 9 05:54:57 2010 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/*.rb: Remove unused variable warnings.
+ Patch by Run Paint [ruby-core:30991]
+
+ * lib/rubygems/*, lib/rdoc/*.rb, lib/rake/*.rb: ditto
+
Mon Nov 8 18:26:03 2010 NARUSE, Yui <naruse@ruby-lang.org>
* util.c (ruby_hdtoa): fix type cast and bufsize.
View
@@ -558,16 +558,16 @@ def memberwise(op, x)
n = ARGV[0].to_i.nonzero? || 50000
puts %Q([#{n} times iterations of `a = "1"'])
benchmark(" " + CAPTION, 7, FMTSTR) do |x|
- x.report("for:") {for i in 1..n; a = "1"; end} # Benchmark::measure
- x.report("times:") {n.times do ; a = "1"; end}
- x.report("upto:") {1.upto(n) do ; a = "1"; end}
+ x.report("for:") {for _ in 1..n; _ = "1"; end} # Benchmark::measure
+ x.report("times:") {n.times do ; _ = "1"; end}
+ x.report("upto:") {1.upto(n) do ; _ = "1"; end}
end
benchmark do
[
- measure{for i in 1..n; a = "1"; end}, # Benchmark::measure
- measure{n.times do ; a = "1"; end},
- measure{1.upto(n) do ; a = "1"; end}
+ measure{for _ in 1..n; _ = "1"; end}, # Benchmark::measure
+ measure{n.times do ; _ = "1"; end},
+ measure{1.upto(n) do ; _ = "1"; end}
]
end
end
View
@@ -122,7 +122,7 @@ def self.parse_uri(uri)
end
def self.open(uri, config)
- host, port, option = parse_uri(uri)
+ host, port, = parse_uri(uri)
host.untaint
port.untaint
soc = TCPSocket.open(host, port)
@@ -134,7 +134,7 @@ def self.open(uri, config)
def self.open_server(uri, config)
uri = 'drbssl://:0' unless uri
- host, port, opt = parse_uri(uri)
+ host, port, = parse_uri(uri)
if host.size == 0
host = getservername
soc = open_server_inaddr_any(host, port)
View
@@ -64,7 +64,7 @@ def alternate
def keeper
Thread.new do
loop do
- size = alternate
+ alternate
sleep(@timeout)
end
end
View
@@ -19,14 +19,14 @@ def self.parse_uri(uri)
end
def self.open(uri, config)
- filename, option = parse_uri(uri)
+ filename, = parse_uri(uri)
filename.untaint
soc = UNIXSocket.open(filename)
self.new(uri, soc, config)
end
def self.open_server(uri, config)
- filename, option = parse_uri(uri)
+ filename, = parse_uri(uri)
if filename.size == 0
soc = temp_server
filename = soc.path
View
@@ -29,12 +29,12 @@ def n_jobs
end
def thread(key)
- th, irb = search(key)
+ th, = search(key)
th
end
def irb(key)
- th, irb = search(key)
+ _, irb = search(key)
irb
end
@@ -62,7 +62,7 @@ def switch(key)
def kill(*keys)
for key in keys
- th, irb = search(key)
+ th, _ = search(key)
IRB.fail IrbAlreadyDead unless th.alive?
th.exit
end
View
@@ -10,5 +10,5 @@
#
while true
- IRB::BINDING_QUEUE.push b = binding
+ IRB::BINDING_QUEUE.push _ = binding
end
View
@@ -322,7 +322,7 @@ def makeport
sock = TCPServer.open(@sock.addr[3], 0)
port = sock.addr[1]
host = sock.addr[3]
- resp = sendport(host, port)
+ sendport(host, port)
return sock
end
private :makeport
View
@@ -1563,7 +1563,7 @@ def main_type
# or sub-type is not given (e.g. "Content-Type: text").
def sub_type
return nil unless @header['content-type']
- main, sub = *self['Content-Type'].split(';').first.to_s.split('/')
+ _, sub = *self['Content-Type'].split(';').first.to_s.split('/')
return nil unless sub
sub.strip
end
View
@@ -2680,7 +2680,6 @@ def getacl_response
token = match(T_ATOM)
name = token.value.upcase
match(T_SPACE)
- mailbox = astring
data = []
token = lookahead
if token.symbol == T_SPACE
View
@@ -105,13 +105,12 @@ def next_token
def _racc_do_parse_rb(arg, in_debug)
action_table, action_check, action_default, action_pointer,
- goto_table, goto_check, goto_default, goto_pointer,
- nt_base, reduce_table, token_table, shift_n,
- reduce_n, use_result, * = arg
+ _, _, _, _,
+ _, _, token_table, _,
+ _, _, * = arg
_racc_init_sysvars
tok = act = i = nil
- nerr = 0
catch(:racc_end_parse) {
while true
@@ -154,14 +153,13 @@ def yyparse(recv, mid)
def _racc_yyparse_rb(recv, mid, arg, c_debug)
action_table, action_check, action_default, action_pointer,
- goto_table, goto_check, goto_default, goto_pointer,
- nt_base, reduce_table, token_table, shift_n,
- reduce_n, use_result, * = arg
+ _, _, _, _,
+ _, _, token_table, _,
+ _, _, * = arg
_racc_init_sysvars
act = nil
i = nil
- nerr = 0
catch(:racc_end_parse) {
until i = action_pointer[@racc_state[-1]]
@@ -210,10 +208,10 @@ def _racc_yyparse_rb(recv, mid, arg, c_debug)
###
def _racc_evalact(act, arg)
- action_table, action_check, action_default, action_pointer,
- goto_table, goto_check, goto_default, goto_pointer,
- nt_base, reduce_table, token_table, shift_n,
- reduce_n, use_result, * = arg
+ action_table, action_check, _, action_pointer,
+ _, _, _, _,
+ _, _, _, shift_n, reduce_n,
+ _, _, * = arg
nerr = 0 # tmp
if act > 0 and act < shift_n
@@ -305,10 +303,10 @@ def _racc_evalact(act, arg)
end
def _racc_do_reduce(arg, act)
- action_table, action_check, action_default, action_pointer,
+ _, _, _, _,
goto_table, goto_check, goto_default, goto_pointer,
- nt_base, reduce_table, token_table, shift_n,
- reduce_n, use_result, * = arg
+ nt_base, reduce_table, _, _,
+ _, use_result, * = arg
state = @racc_state
vstack = @racc_vstack
tstack = @racc_tstack
View
@@ -115,7 +115,7 @@ def to_string
def doctype
if @element
doc = @element.document
- doctype = doc.doctype if doc
+ doc.doctype if doc
end
end
View
@@ -88,7 +88,7 @@ def document
# This doesn't yet handle encodings
def bytes
- encoding = document.encoding
+ document.encoding
to_s
end
View
@@ -115,7 +115,6 @@ def write( output, indent=0, transitive=false, ie_hack=false )
output << " #{@long_name.inspect}" if @long_name
output << " #{@uri.inspect}" if @uri
unless @children.empty?
- next_indent = indent + 1
output << ' ['
@children.each { |child|
output << "\n"
View
@@ -874,7 +874,6 @@ def delete_all( xpath )
# a.elements.add(Element.new('b')) #-> <a><b/></a>
# a.elements.add('c') #-> <a><b/><c/></a>
def add element=nil
- rv = nil
if element.nil?
Element.new("", self, @element.context)
elsif not element.kind_of?(Element)
@@ -1092,7 +1091,7 @@ def []=( name, value )
delete attr
return
end
- element_document = @element.document
+
unless value.kind_of? Attribute
if @element.document and @element.document.doctype
value = Text::normalize( value, @element.document.doctype )
@@ -1197,7 +1196,7 @@ def delete( attribute )
return @element
else # the supplied attribute is a top-level one
attr = old
- res = super(name)
+ super(name)
end
@element
end
@@ -37,7 +37,6 @@ def write_element( node, output )
# If compact and all children are text, and if the formatted output
# is less than the specified width, then try to print everything on
# one line
- skip = false
@level += @indentation
node.children.each { |child|
write( child, output )
View
@@ -170,7 +170,6 @@ def Functions::substring_before( string, test )
# Kouhei fixed this too
def Functions::substring_after( string, test )
ruby_string = string(string)
- test_string = string(test)
return $1 if ruby_string =~ /#{test}(.*)/
""
end
@@ -87,7 +87,7 @@ def parse
@listeners.each { |sym,match,block|
block.start_document if sym == :start_document or sym.nil?
}
- root = context = []
+ context = []
while true
event = @parser.pull
case event[0]
@@ -282,7 +282,6 @@ def RelativeLocationPath path, parsed
PI = /^processing-instruction\(/
def NodeTest path, parsed
#puts "NodeTest with #{path}"
- res = nil
case path
when /^\*/
path = $'
@@ -578,7 +577,6 @@ def FilterExpr path, parsed
NUMBER = /^(\d*\.?\d+)/
NT = /^comment|text|processing-instruction|node$/
def PrimaryExpr path, parsed
- arry = []
case path
when VARIABLE_REFERENCE
varname = $1
View
@@ -33,7 +33,6 @@ def QuickPath::match element, path, namespaces=EMPTY_HASH
results = filter(element.to_a, path)
when /^[\[!\w:]/u
# match on child
- matches = []
children = element.to_a
results = filter(children, path)
else
@@ -51,8 +50,6 @@ def QuickPath::filter elements, path
when /^\/\//u # Descendant
return axe( elements, "descendant-or-self", $' )
when /^\/?\b(\w[-\w]*)\b::/u # Axe
- axe_name = $1
- rest = $'
return axe( elements, $1, $' )
when /^\/(?=\b([:!\w][-\.\w]*:)?[-!\*\.\w]*\b([^:(]|$)|\*)/u # Child
rest = $'
@@ -33,7 +33,7 @@ def validate( event )
sattr = [:start_attribute, nil]
eattr = [:end_attribute]
text = [:text, nil]
- k,v = event[2].find { |key,value|
+ k, = event[2].find { |key,value|
sattr[1] = key
#puts "Looking for #{sattr.inspect}"
m = @current.next( sattr )
@@ -687,7 +687,7 @@ def equality_relational_compare( set1, op, set2 )
return rv
else
res = []
- enum = SyncEnumerator.new( set1, set2 ).each { |i1, i2|
+ SyncEnumerator.new( set1, set2 ).each { |i1, i2|
#puts "i1 = #{i1.inspect} (#{i1.class.name})"
#puts "i2 = #{i2.inspect} (#{i2.class.name})"
i1 = norm( i1 )
View
@@ -198,7 +198,7 @@ def lookup_ring(timeout=5, &block)
def lookup_ring_any(timeout=5)
queue = Queue.new
- th = Thread.new do
+ Thread.new do
self.lookup_ring(timeout) do |ts|
queue.push(ts)
end
@@ -252,7 +252,7 @@ def provide
when 's'
require 'rinda/tuplespace'
ts = Rinda::TupleSpace.new
- place = Rinda::RingServer.new(ts)
+ Rinda::RingServer.new(ts)
$stdin.gets
when 'w'
finger = Rinda::RingFinger.new(nil)
View
@@ -527,7 +527,7 @@ def inline_other_text?
return false unless inline_other?
return false if inline_other_xml?
- media_type, subtype = mime_split
+ media_type, = mime_split
return true if "text" == media_type.downcase
false
end
View
@@ -24,7 +24,7 @@ def setup_elements(rss)
class Channel < ChannelBase
def to_feed(rss)
channel = Rss::Channel.new
- set = setup_values(channel)
+ setup_values(channel)
_not_set_required_variables = not_set_required_variables
if _not_set_required_variables.empty?
rss.channel = channel
@@ -257,7 +257,7 @@ def to_feed(rss)
class Item < ItemBase
def to_feed(rss)
item = Rss::Channel::Item.new
- set = setup_values(item)
+ setup_values(item)
_not_set_required_variables = not_set_required_variables
if _not_set_required_variables.empty?
rss.items << item
View
@@ -32,7 +32,7 @@ def to_feed(rss)
_not_set_required_variables = not_set_required_variables
if _not_set_required_variables.empty?
channel = RDF::Channel.new(@about)
- set = setup_values(channel)
+ setup_values(channel)
channel.dc_dates.clear
rss.channel = channel
set_parent(channel, rss)
@@ -11,10 +11,7 @@ def self.append_features(klass)
plural_name ||= "#{name}s"
full_name = "#{RSS::DC_PREFIX}_#{name}"
full_plural_name = "#{RSS::DC_PREFIX}_#{plural_name}"
- klass_name = Utils.to_class_name(name)
plural_klass_name = "DublinCore#{Utils.to_class_name(plural_name)}"
- full_plural_klass_name = "self.class::#{plural_klass_name}"
- full_klass_name = "#{full_plural_klass_name}::#{klass_name}"
klass.def_classed_elements(full_name, "value", plural_klass_name,
full_plural_name, name)
klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
Oops, something went wrong.

0 comments on commit f3e3547

Please sign in to comment.