aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-07-23 00:36:34 -0300
committerJosé Valim <jose.valim@gmail.com>2010-07-24 01:19:44 +0200
commite1d4e78b15141cf940be7a84ca856425484a98be (patch)
treebeeb97f6667df9c003d915ddac08d29fb9ded8e0
parent80cf6559ed0f35cc525c9f2f90cf483033f6dad7 (diff)
downloadrails-e1d4e78b15141cf940be7a84ca856425484a98be.tar.gz
rails-e1d4e78b15141cf940be7a84ca856425484a98be.tar.bz2
rails-e1d4e78b15141cf940be7a84ca856425484a98be.zip
Removes unused vars
Signed-off-by: José Valim <jose.valim@gmail.com>
-rw-r--r--actionmailer/lib/action_mailer/test_case.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/requires.rb4
-rw-r--r--activesupport/lib/active_support/dependencies.rb2
-rw-r--r--activesupport/lib/active_support/json/backends/yaml.rb2
-rw-r--r--activesupport/lib/active_support/multibyte/unicode.rb11
-rw-r--r--activesupport/lib/active_support/testing/setup_and_teardown.rb2
-rw-r--r--activesupport/test/caching_test.rb2
-rw-r--r--activesupport/test/core_ext/module_test.rb2
-rw-r--r--activesupport/test/dependencies_test.rb2
-rw-r--r--activesupport/test/json/encoding_test.rb2
-rw-r--r--activesupport/test/memoizable_test.rb1
-rw-r--r--activesupport/test/multibyte_chars_test.rb2
-rw-r--r--activesupport/test/ordered_hash_test.rb2
-rw-r--r--activesupport/test/test_test.rb2
14 files changed, 17 insertions, 21 deletions
diff --git a/actionmailer/lib/action_mailer/test_case.rb b/actionmailer/lib/action_mailer/test_case.rb
index b91eed592a..f4d1bb59f1 100644
--- a/actionmailer/lib/action_mailer/test_case.rb
+++ b/actionmailer/lib/action_mailer/test_case.rb
@@ -28,7 +28,7 @@ module ActionMailer
def determine_default_mailer(name)
name.sub(/Test$/, '').constantize
- rescue NameError => e
+ rescue NameError
raise NonInferrableMailerError.new(name)
end
end
diff --git a/activesupport/lib/active_support/core_ext/kernel/requires.rb b/activesupport/lib/active_support/core_ext/kernel/requires.rb
index d2238898d6..3bf46271d7 100644
--- a/activesupport/lib/active_support/core_ext/kernel/requires.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/requires.rb
@@ -11,13 +11,13 @@ module Kernel
# 1. Requiring the module is unsuccessful, maybe it's a gem and nobody required rubygems yet. Try.
begin
require 'rubygems'
- rescue LoadError => rubygems_not_installed
+ rescue LoadError # => rubygems_not_installed
raise cannot_require
end
# 2. Rubygems is installed and loaded. Try to load the library again
begin
require library_name
- rescue LoadError => gem_not_installed
+ rescue LoadError # => gem_not_installed
raise cannot_require
end
end
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 7d5143ba37..9a6da38b1c 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -592,7 +592,7 @@ module ActiveSupport #:nodoc:
# Convert the provided const desc to a qualified constant name (as a string).
# A module, class, symbol, or string may be provided.
def to_constant_name(desc) #:nodoc:
- name = case desc
+ case desc
when String then desc.sub(/^::/, '')
when Symbol then desc.to_s
when Module
diff --git a/activesupport/lib/active_support/json/backends/yaml.rb b/activesupport/lib/active_support/json/backends/yaml.rb
index 215b3d6f90..4cb9d01077 100644
--- a/activesupport/lib/active_support/json/backends/yaml.rb
+++ b/activesupport/lib/active_support/json/backends/yaml.rb
@@ -13,7 +13,7 @@ module ActiveSupport
json = json.read
end
YAML.load(convert_json_to_yaml(json))
- rescue ArgumentError => e
+ rescue ArgumentError
raise ParseError, "Invalid JSON string"
end
diff --git a/activesupport/lib/active_support/multibyte/unicode.rb b/activesupport/lib/active_support/multibyte/unicode.rb
index 11c72d873b..3d80f5fa58 100644
--- a/activesupport/lib/active_support/multibyte/unicode.rb
+++ b/activesupport/lib/active_support/multibyte/unicode.rb
@@ -99,15 +99,15 @@ module ActiveSupport
current = codepoints[pos]
if (
# CR X LF
- one = ( previous == database.boundary[:cr] and current == database.boundary[:lf] ) or
+ ( previous == database.boundary[:cr] and current == database.boundary[:lf] ) or
# L X (L|V|LV|LVT)
- two = ( database.boundary[:l] === previous and in_char_class?(current, [:l,:v,:lv,:lvt]) ) or
+ ( database.boundary[:l] === previous and in_char_class?(current, [:l,:v,:lv,:lvt]) ) or
# (LV|V) X (V|T)
- three = ( in_char_class?(previous, [:lv,:v]) and in_char_class?(current, [:v,:t]) ) or
+ ( in_char_class?(previous, [:lv,:v]) and in_char_class?(current, [:v,:t]) ) or
# (LVT|T) X (T)
- four = ( in_char_class?(previous, [:lvt,:t]) and database.boundary[:t] === current ) or
+ ( in_char_class?(previous, [:lvt,:t]) and database.boundary[:t] === current ) or
# X Extend
- five = (database.boundary[:extend] === current)
+ (database.boundary[:extend] === current)
)
else
unpacked << codepoints[marker..pos-1]
@@ -238,7 +238,6 @@ module ActiveSupport
bytes.each_index do |i|
byte = bytes[i]
- is_ascii = byte < 128
is_cont = byte > 127 && byte < 192
is_lead = byte > 191 && byte < 245
is_unused = byte > 240
diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb
index d8942c3974..b2d9ddfeb7 100644
--- a/activesupport/lib/active_support/testing/setup_and_teardown.rb
+++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb
@@ -96,7 +96,7 @@ module ActiveSupport
protected
def retrieve_mocha_counter(result) #:nodoc:
- if using_mocha = respond_to?(:mocha_verify)
+ if respond_to?(:mocha_verify) # using mocha
if defined?(Mocha::TestCaseAdapter::AssertionCounter)
Mocha::TestCaseAdapter::AssertionCounter.new(result)
else
diff --git a/activesupport/test/caching_test.rb b/activesupport/test/caching_test.rb
index 3e14c754b7..212c1f82a8 100644
--- a/activesupport/test/caching_test.rb
+++ b/activesupport/test/caching_test.rb
@@ -279,7 +279,7 @@ module CacheStoreBehavior
assert_equal 'bar', @cache.read('foo')
raise ArgumentError.new
end
- rescue ArgumentError => e
+ rescue ArgumentError
end
assert_equal "bar", @cache.read('foo')
Time.stubs(:now).returns(time + 71)
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb
index 39ee0ac748..5d9cdf22c2 100644
--- a/activesupport/test/core_ext/module_test.rb
+++ b/activesupport/test/core_ext/module_test.rb
@@ -147,7 +147,7 @@ class ModuleTest < Test::Unit::TestCase
end
assert_nothing_raised do
- child = Class.new(parent) do
+ Class.new(parent) do
class << self
delegate :parent_method, :to => :superclass
end
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index 4b8c7897b7..d7bde185bd 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -419,7 +419,6 @@ class DependenciesTest < Test::Unit::TestCase
def test_removal_from_tree_should_be_detected
with_loading 'dependencies' do
- root = ActiveSupport::Dependencies.autoload_paths.first
c = ServiceOne
ActiveSupport::Dependencies.clear
assert ! defined?(ServiceOne)
@@ -434,7 +433,6 @@ class DependenciesTest < Test::Unit::TestCase
def test_references_should_work
with_loading 'dependencies' do
- root = ActiveSupport::Dependencies.autoload_paths.first
c = ActiveSupport::Dependencies.ref("ServiceOne")
service_one_first = ServiceOne
assert_equal service_one_first, c.get
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index a679efb41e..1527d02d16 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -148,7 +148,7 @@ class TestJSONEncoding < Test::Unit::TestCase
:latitude => 123.234
}
}
- result = ActiveSupport::JSON.encode(hash)
+ ActiveSupport::JSON.encode(hash)
end
end
diff --git a/activesupport/test/memoizable_test.rb b/activesupport/test/memoizable_test.rb
index 195e3eaa42..b11fa8d346 100644
--- a/activesupport/test/memoizable_test.rb
+++ b/activesupport/test/memoizable_test.rb
@@ -134,7 +134,6 @@ class MemoizableTest < ActiveSupport::TestCase
end
def test_reloadable
- counter = @calculator.counter
assert_equal 1, @calculator.counter
assert_equal 2, @calculator.counter(:reload)
assert_equal 2, @calculator.counter
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index 78232d8eb5..6ebbfdf334 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -234,7 +234,7 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase
def test_include_raises_when_nil_is_passed
@chars.include?(nil)
flunk "Expected chars.include?(nil) to raise TypeError or NoMethodError"
- rescue Exception => e
+ rescue Exception
end
def test_index_should_return_character_offset
diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb
index d340bed444..f47e896487 100644
--- a/activesupport/test/ordered_hash_test.rb
+++ b/activesupport/test/ordered_hash_test.rb
@@ -214,7 +214,7 @@ class OrderedHashTest < Test::Unit::TestCase
def test_alternate_initialization_raises_exception_on_odd_length_args
begin
- alternate = ActiveSupport::OrderedHash[1,2,3,4,5]
+ ActiveSupport::OrderedHash[1,2,3,4,5]
flunk "Hash::[] should have raised an exception on initialization " +
"with an odd number of parameters"
rescue
diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb
index 3092fe01ae..633d3b212b 100644
--- a/activesupport/test/test_test.rb
+++ b/activesupport/test/test_test.rb
@@ -49,8 +49,8 @@ class AssertDifferenceTest < ActiveSupport::TestCase
end
def test_expression_is_evaluated_in_the_appropriate_scope
- local_scope = 'foo'
silence_warnings do
+ local_scope = 'foo'
assert_difference('local_scope; @object.num') { @object.increment }
end
end