From 70510d026f8d86693dccaba07417488eed09b41d Mon Sep 17 00:00:00 2001 From: marcandre Date: Sun, 11 Jul 2010 16:59:10 +0000 Subject: * lib/csv.rb: Fix unused variable warnings. Patch by Run Paint [ruby-core:30991] * lib/date.rb: ditto * lib/debug.rb: ditto * lib/drb/drb.rb: ditto * lib/drb/invokemethod.rb: ditto * lib/irb/ruby-lex.rb: ditto * lib/irb/slex.rb: ditto * lib/logger.rb: ditto * lib/pathname.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/csv.rb | 4 ---- lib/date.rb | 10 +++++----- lib/debug.rb | 4 ++-- lib/drb/drb.rb | 4 ++-- lib/drb/invokemethod.rb | 2 +- lib/irb/ruby-lex.rb | 2 +- lib/irb/slex.rb | 2 +- lib/logger.rb | 4 ++-- lib/pathname.rb | 6 +++--- 9 files changed, 17 insertions(+), 21 deletions(-) (limited to 'lib') diff --git a/lib/csv.rb b/lib/csv.rb index d870dfe229..20a1977c9c 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -1813,9 +1813,6 @@ class CSV end end - # begin with a blank line, so we can always add to it - line = "" - # # it can take multiple calls to @io.gets() to get a full line, # because of \r and/or \n characters embedded in quoted fields @@ -2080,7 +2077,6 @@ class CSV @field_size_limit = options.delete(:field_size_limit) # prebuild Regexps for faster parsing - esc_col_sep = escape_re(@col_sep) esc_row_sep = escape_re(@row_sep) esc_quote = escape_re(@quote_char) @parsers = { diff --git a/lib/date.rb b/lib/date.rb index 3bb0875023..5295ce9b7f 100644 --- a/lib/date.rb +++ b/lib/date.rb @@ -470,7 +470,7 @@ class Date end def jd_to_weeknum(jd, f=0, sg=GREGORIAN) # :nodoc: - y, m, d = jd_to_civil(jd, sg) + y, _, d = jd_to_civil(jd, sg) a = find_fdoy(y, sg) + 6 w, d = (jd - (a - ((a - f) + 1) % 7) + 7).divmod(7) return y, w, d @@ -486,7 +486,7 @@ class Date end def jd_to_nth_kday(jd, sg=GREGORIAN) # :nodoc: - y, m, d = jd_to_civil(jd, sg) + y, m, = jd_to_civil(jd, sg) j = find_fdom(y, m, sg) return y, m, ((jd - j) / 7).floor + 1, jd_to_wday(jd) end @@ -645,7 +645,7 @@ class Date d += 8 end if w < 0 - ny, nw, nd = + ny, nw, = jd_to_commercial(commercial_to_jd(y + 1, 1, 1, sg) + w * 7, sg) return unless ny == y w = nw @@ -660,7 +660,7 @@ class Date d += 7 end if w < 0 - ny, nw, nd, nf = + ny, nw, = jd_to_weeknum(weeknum_to_jd(y + 1, 1, f, f, sg) + w * 7, f, sg) return unless ny == y w = nw @@ -677,7 +677,7 @@ class Date if n < 0 ny, nm = (y * 12 + m).divmod(12) nm, = (nm + 1) .divmod(1) - ny, nm, nn, nk = + ny, nm, nn, = jd_to_nth_kday(nth_kday_to_jd(ny, nm, 1, k, sg) + n * 7, sg) return unless [ny, nm] == [y, m] n = nn diff --git a/lib/debug.rb b/lib/debug.rb index 10236c352d..b97486d236 100644 --- a/lib/debug.rb +++ b/lib/debug.rb @@ -125,7 +125,7 @@ class Context def debug_eval(str, binding) begin - val = eval(str, binding) + eval(str, binding) rescue StandardError, ScriptError => e at = eval("caller(1)", binding) stdout.printf "%s:%s\n", at.shift, e.to_s.sub(/\(eval\):1:(in `.*?':)?/, '') @@ -585,7 +585,7 @@ EOHELP end def format_frame(pos) - bind, file, line, id = @frames[pos] + _, file, line, id = @frames[pos] sprintf "#%d %s:%s%s\n", pos + 1, file, line, (id ? ":in `#{id.id2name}'" : "") end diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 84a21440ed..cacca145e9 100644 --- a/lib/drb/drb.rb +++ b/lib/drb/drb.rb @@ -820,7 +820,7 @@ module DRb # Open a client connection to +uri+ using configuration +config+. 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) @@ -852,7 +852,7 @@ module DRb # configuration +config+. def self.open_server(uri, config) uri = 'druby://:0' unless uri - host, port, opt = parse_uri(uri) + host, port, _ = parse_uri(uri) config = {:tcp_original_host => host}.update(config) if host.size == 0 host = getservername diff --git a/lib/drb/invokemethod.rb b/lib/drb/invokemethod.rb index 220d0ad68d..5a231ed67b 100644 --- a/lib/drb/invokemethod.rb +++ b/lib/drb/invokemethod.rb @@ -7,7 +7,7 @@ module DRb if x.size == 1 && x[0].class == Array x[0] = DRbArray.new(x[0]) end - block_value = @block.call(*x) + @block.call(*x) end def perform_with_block diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 76e3ebac44..72600289b8 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -623,7 +623,7 @@ class RubyLex tk_c = TkLPAREN end @indent_stack.push tk_c - tk = Token(tk_c) + Token(tk_c) end @OP.def_rule("[]", proc{|op, io| @lex_state == EXPR_FNAME}) do diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb index fac62bfd93..b395eaa475 100644 --- a/lib/irb/slex.rb +++ b/lib/irb/slex.rb @@ -35,7 +35,7 @@ module IRB D_DETAIL.pp token postproc = block if block_given? - node = create(token, preproc, postproc) + create(token, preproc, postproc) end def def_rules(*tokens, &block) diff --git a/lib/logger.rb b/lib/logger.rb index 6c33f7b3be..5c00fe24c2 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -176,7 +176,7 @@ require 'monitor' class Logger VERSION = "1.2.7" - id, name, rev = %w$Id$ + _, name, rev = %w$Id$ if name name = name.chomp(",v") else @@ -530,7 +530,7 @@ private @mutex.synchronize do @dev.close rescue nil end - rescue Exception => ignored + rescue Exception @dev.close rescue nil end end diff --git a/lib/pathname.rb b/lib/pathname.rb index cede33d273..f24fd4d76d 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -496,7 +496,7 @@ class Pathname def relative? path = @path while r = chop_basename(path) - path, basename = r + path, = r end path == '' end @@ -509,7 +509,7 @@ class Pathname # def each_filename # :yield: filename return to_enum(__method__) unless block_given? - prefix, names = split_names(@path) + _, names = split_names(@path) names.each {|filename| yield filename } nil end @@ -565,7 +565,7 @@ class Pathname path = @path yield self while r = chop_basename(path) - path, name = r + path, = r break if path.empty? yield self.class.new(del_trailing_separator(path)) end -- cgit v1.2.3