From 448c87008e1bc66a93b8f21eedea060f281874a4 Mon Sep 17 00:00:00 2001 From: hsbt Date: Sun, 27 Jul 2014 11:04:28 +0000 Subject: [PATCH] * lib/cgi/core.rb: remove unused variables. * lib/erb.rb: ditto. * lib/mkmf.rb: ditto. * lib/net/http/response.rb: ditto. * lib/optparse/version.rb: ditto. * lib/prime.rb: ditto. * lib/racc/parser.rb: ditto. * lib/rexml/document.rb: ditto. * lib/rexml/dtd/dtd.rb: ditto. * lib/rexml/element.rb: ditto. * lib/rexml/functions.rb: ditto. * lib/rexml/parsers/xpathparser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 15 +++++++++++++++ lib/cgi/core.rb | 1 - lib/erb.rb | 2 +- lib/mkmf.rb | 3 +-- lib/net/http/response.rb | 1 - lib/optparse/version.rb | 2 +- lib/prime.rb | 2 +- lib/racc/parser.rb | 2 -- lib/rexml/document.rb | 2 +- lib/rexml/dtd/dtd.rb | 5 ----- lib/rexml/element.rb | 4 +--- lib/rexml/functions.rb | 2 +- lib/rexml/parsers/xpathparser.rb | 2 +- 13 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01fcfcd2c5..40e66c00e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Sun Jul 27 19:49:36 2014 SHIBATA Hiroshi + + * lib/cgi/core.rb: remove unused variables. + * lib/erb.rb: ditto. + * lib/mkmf.rb: ditto. + * lib/net/http/response.rb: ditto. + * lib/optparse/version.rb: ditto. + * lib/prime.rb: ditto. + * lib/racc/parser.rb: ditto. + * lib/rexml/document.rb: ditto. + * lib/rexml/dtd/dtd.rb: ditto. + * lib/rexml/element.rb: ditto. + * lib/rexml/functions.rb: ditto. + * lib/rexml/parsers/xpathparser.rb: ditto. + Sun Jul 27 05:11:21 2014 Zachary Scott * lib/irb.rb: [DOC] PROMPT_I cannot be nil, patch by @hgillane diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index 6fb4a8f997..b81f915379 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -479,7 +479,6 @@ class CGI @files = {} boundary_rexp = /--#{Regexp.quote(boundary)}(#{EOL}|--)/ boundary_size = "#{EOL}--#{boundary}#{EOL}".bytesize - boundary_end = nil buf = '' bufsize = 10 * 1024 max_count = MAX_MULTIPART_COUNT diff --git a/lib/erb.rb b/lib/erb.rb index 9c32131288..b30812fa95 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -717,7 +717,7 @@ class ERB comment = $1 if comment[/-\*-\s*(.*?)\s*-*-$/] if %r"coding\s*[=:]\s*([[:alnum:]\-_]+)" =~ comment enc = $1.sub(/-(?:mac|dos|unix)/i, '') - enc = Encoding.find(enc) + Encoding.find(enc) end end end diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 541984b8b6..bc93fec6c4 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -667,7 +667,6 @@ SRC return nil end upper = 1 - lower = 0 until try_static_assert("#{const} <= #{upper}", headers, opt) lower = upper upper <<= 1 @@ -2253,7 +2252,7 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""} fseprepl = proc {|s| s = s.gsub("/", fsep) s = s.gsub(/(\$\(\w+)(\))/) {$1+sep+$2} - s = s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2} + s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2} } rsep = ":#{fsep}=/" else diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb index 45115295d9..777aca9e45 100644 --- a/lib/net/http/response.rb +++ b/lib/net/http/response.rb @@ -306,7 +306,6 @@ class Net::HTTPResponse # See RFC 2616 section 3.6.1 for definitions def read_chunked(dest, chunk_data_io) # :nodoc: - len = nil total = 0 while true line = @socket.readline diff --git a/lib/optparse/version.rb b/lib/optparse/version.rb index 76ed564287..8525677418 100644 --- a/lib/optparse/version.rb +++ b/lib/optparse/version.rb @@ -51,7 +51,7 @@ class << OptionParser raise NameError, path unless Module === klass klass.constants.grep(/#{name}/i) do |c| klass.const_defined?(c) or next - c = klass.const_get(c) + klass.const_get(c) end end end diff --git a/lib/prime.rb b/lib/prime.rb index cbbf7e519f..ebe012b613 100644 --- a/lib/prime.rb +++ b/lib/prime.rb @@ -180,7 +180,7 @@ class Prime # Prime.int_from_prime_division([[2,2], [3,1]]) #=> 12 def int_from_prime_division(pd) pd.inject(1){|value, (prime, index)| - value *= prime**index + value * prime**index } end diff --git a/lib/racc/parser.rb b/lib/racc/parser.rb index 9e6de03dd5..f811ab6e78 100644 --- a/lib/racc/parser.rb +++ b/lib/racc/parser.rb @@ -380,7 +380,6 @@ module Racc _, _, _, _, _, _, _, shift_n, reduce_n, _, _, * = arg - nerr = 0 # tmp if act > 0 and act < shift_n # @@ -431,7 +430,6 @@ module Racc case @racc_error_status when 0 unless arg[21] # user_yyerror - nerr += 1 on_error @racc_t, @racc_val, @racc_vstack end when 3 diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb index 1e18263dda..8342b96e6a 100644 --- a/lib/rexml/document.rb +++ b/lib/rexml/document.rb @@ -123,7 +123,7 @@ module REXML def xml_decl rv = @children[0] return rv if rv.kind_of? XMLDecl - rv = @children.unshift(XMLDecl.default)[0] + @children.unshift(XMLDecl.default)[0] end # @return the XMLDecl version of this document as a String. diff --git a/lib/rexml/dtd/dtd.rb b/lib/rexml/dtd/dtd.rb index 966e39ea57..62317bac9e 100644 --- a/lib/rexml/dtd/dtd.rb +++ b/lib/rexml/dtd/dtd.rb @@ -24,23 +24,18 @@ module REXML case input when ElementDecl.PATTERN_RE match = $& - source = $' contents << ElementDecl.new( match ) when AttlistDecl.PATTERN_RE matchdata = $~ - source = $' contents << AttlistDecl.new( matchdata ) when EntityDecl.PATTERN_RE matchdata = $~ - source = $' contents << EntityDecl.new( matchdata ) when Comment.PATTERN_RE matchdata = $~ - source = $' contents << Comment.new( matchdata ) when NotationDecl.PATTERN_RE matchdata = $~ - source = $' contents << NotationDecl.new( matchdata ) end end diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb index 94b00d7284..e459704d3c 100644 --- a/lib/rexml/element.rb +++ b/lib/rexml/element.rb @@ -1181,9 +1181,8 @@ module REXML prefix = '' unless prefix end old = fetch(name, nil) - attr = nil if old.kind_of? Hash # the supplied attribute is one of many - attr = old.delete(prefix) + old.delete(prefix) if old.size == 1 repl = nil old.each_value{|v| repl = v} @@ -1192,7 +1191,6 @@ module REXML elsif old.nil? return @element else # the supplied attribute is a top-level one - attr = old super(name) end @element diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb index 20c8961aee..2010be14e0 100644 --- a/lib/rexml/functions.rb +++ b/lib/rexml/functions.rb @@ -363,7 +363,7 @@ module REXML def Functions::sum( nodes ) nodes = [nodes] unless nodes.kind_of? Array - nodes.inject(0) { |r,n| r += number(string(n)) } + nodes.inject(0) { |r,n| r + number(string(n)) } end def Functions::floor( number ) diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb index e643d11511..d30aa34f6e 100644 --- a/lib/rexml/parsers/xpathparser.rb +++ b/lib/rexml/parsers/xpathparser.rb @@ -21,7 +21,7 @@ module REXML path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces path.gsub!( /\s+([\]\)])/, '\1') parsed = [] - path = OrExpr(path, parsed) + OrExpr(path, parsed) parsed end