grosser/fast_gettext — pull request #31 by kou (2011-12-04 13:48:38+00:00)
Title: suppress some warnings on Ruby 1.9.3.

I get some warnings on Ruby 1.9.3 by running rake with $VERBOSE = true:

```
% git --no-pager diff
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 8c5c45d..5096334 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,3 +1,5 @@
+$VERBOSE = true
+
# ---- requirements
require 'rubygems'
$LOAD_PATH.unshift File.expand_path("../lib", File.dirname(__FILE__))
% rake
AR='~>2' && (bundle || bundle install) && bundle exec rspec spec
Using rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0)
Using arel (2.2.1)
Using tzinfo (0.3.29)
Using activerecord (3.1.0)
Using bundler (1.0.21)
Using diff-lcs (1.1.3)
Using git (1.2.5)
Using jeweler (1.6.4)
Using rspec-core (2.6.4)
Using rspec-expectations (2.6.0)
Using rspec-mocks (2.6.0)
Using rspec (2.6.0)
Using sqlite3 (1.3.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/mofile.rb:191: warning: assigned but unused variable - i
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:27: warning: method redefined; discarding old available_locales
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of available_locales was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:45: warning: method redefined; discarding old text_domain
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of text_domain was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:63: warning: method redefined; discarding old pluralisation_rule
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of pluralisation_rule was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/translation.rb:30: warning: `*' interpreted as argument prefix
/var/lib/gems/1.9.1/gems/rspec-mocks-2.6.0/lib/rspec/mocks/argument_matchers.rb:63: warning: assigned but unused variable - ex
/var/lib/gems/1.9.1/gems/rspec-mocks-2.6.0/lib/rspec/mocks/argument_matchers.rb:82: warning: assigned but unused variable - ex
/var/lib/gems/1.9.1/gems/rspec-mocks-2.6.0/lib/rspec/mocks/any_instance.rb:19: warning: shadowing outer local variable - instance
/var/lib/gems/1.9.1/gems/rspec-expectations-2.6.0/lib/rspec/matchers/cover.rb:22: warning: `&' interpreted as argument prefix
/var/lib/gems/1.9.1/gems/rspec-expectations-2.6.0/lib/rspec/matchers/cover.rb:26: warning: `&' interpreted as argument prefix
/var/lib/gems/1.9.1/gems/rspec-expectations-2.6.0/lib/rspec/matchers/raise_error.rb:28: warning: assigned but unused variable - rcov_error_report
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/vendor/string_spec.rb:30: warning: `%' after local variable is interpreted as binary operator
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/vendor/string_spec.rb:30: warning: even though it seems like string literal
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository_spec.rb:28: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository_spec.rb:29: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:45: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:46: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:72: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:146: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:152: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:156: warning: possibly useless use of == in void context
/var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:2057: warning: assigned but unused variable - ex
/usr/lib/ruby/1.9.1/bigdecimal/util.rb:79: warning: method redefined; discarding old to_d
/var/lib/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/core_ext/big_decimal/conversions.rb:32: warning: previous definition of to_d was here
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository/yaml_spec.rb:42: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository/yaml_spec.rb:43: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository/mo_spec.rb:26: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository/po_spec.rb:26: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:18: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:19: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:20: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:21: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:59: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:60: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:269: warning: possibly useless use of == in void context
......../home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/string.rb:70: warning: too many arguments for format string
./home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/string.rb:70: warning: too many arguments for format string
../home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/string.rb:70: warning: too many arguments for format string
................................-- create_table(:translation_keys)
-> 0.0035s
-- create_table(:translation_texts)
-> 0.0008s
-- initialize_schema_migrations_table()
-> 0.0007s
-- assume_migrated_upto_version(1, ["db/migrate"])
-> 0.0006s
../var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/associations/collection_proxy.rb:81: warning: assigned but unused variable - record
.........................................................................................................

Finished in 4.79 seconds
150 examples, 0 failures
AR='~>3' && (bundle || bundle install) && bundle exec rspec spec
Using rake (0.9.2)
Using multi_json (1.0.3)
Using activesupport (3.1.0)
Using bcrypt-ruby (3.0.1)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.0)
Using arel (2.2.1)
Using tzinfo (0.3.29)
Using activerecord (3.1.0)
Using bundler (1.0.21)
Using diff-lcs (1.1.3)
Using git (1.2.5)
Using jeweler (1.6.4)
Using rspec-core (2.6.4)
Using rspec-expectations (2.6.0)
Using rspec-mocks (2.6.0)
Using rspec (2.6.0)
Using sqlite3 (1.3.4)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/mofile.rb:191: warning: assigned but unused variable - i
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:27: warning: method redefined; discarding old available_locales
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of available_locales was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:45: warning: method redefined; discarding old text_domain
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of text_domain was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:63: warning: method redefined; discarding old pluralisation_rule
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of pluralisation_rule was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/translation.rb:30: warning: `*' interpreted as argument prefix
/var/lib/gems/1.9.1/gems/rspec-mocks-2.6.0/lib/rspec/mocks/argument_matchers.rb:63: warning: assigned but unused variable - ex
/var/lib/gems/1.9.1/gems/rspec-mocks-2.6.0/lib/rspec/mocks/argument_matchers.rb:82: warning: assigned but unused variable - ex
/var/lib/gems/1.9.1/gems/rspec-mocks-2.6.0/lib/rspec/mocks/any_instance.rb:19: warning: shadowing outer local variable - instance
/var/lib/gems/1.9.1/gems/rspec-expectations-2.6.0/lib/rspec/matchers/cover.rb:22: warning: `&' interpreted as argument prefix
/var/lib/gems/1.9.1/gems/rspec-expectations-2.6.0/lib/rspec/matchers/cover.rb:26: warning: `&' interpreted as argument prefix
/var/lib/gems/1.9.1/gems/rspec-expectations-2.6.0/lib/rspec/matchers/raise_error.rb:28: warning: assigned but unused variable - rcov_error_report
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/vendor/string_spec.rb:30: warning: `%' after local variable is interpreted as binary operator
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/vendor/string_spec.rb:30: warning: even though it seems like string literal
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository_spec.rb:28: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository_spec.rb:29: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:45: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:46: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:72: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:146: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:152: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_spec.rb:156: warning: possibly useless use of == in void context
/var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:2057: warning: assigned but unused variable - ex
/usr/lib/ruby/1.9.1/bigdecimal/util.rb:79: warning: method redefined; discarding old to_d
/var/lib/gems/1.9.1/gems/activesupport-3.1.0/lib/active_support/core_ext/big_decimal/conversions.rb:32: warning: previous definition of to_d was here
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository/yaml_spec.rb:42: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository/yaml_spec.rb:43: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository/mo_spec.rb:26: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/translation_repository/po_spec.rb:26: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:18: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:19: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:20: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:21: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:59: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:60: warning: possibly useless use of == in void context
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/storage_spec.rb:269: warning: possibly useless use of == in void context
......../home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/string.rb:70: warning: too many arguments for format string
./home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/string.rb:70: warning: too many arguments for format string
../home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/string.rb:70: warning: too many arguments for format string
................................-- create_table(:translation_keys)
-> 0.0032s
-- create_table(:translation_texts)
-> 0.0005s
-- initialize_schema_migrations_table()
-> 0.0005s
-- assume_migrated_upto_version(1, ["db/migrate"])
-> 0.0002s
../var/lib/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/associations/collection_proxy.rb:81: warning: assigned but unused variable - record
.........................................................................................................

Finished in 4.87 seconds
150 examples, 0 failures
rake 11.76s user 0.72s system 90% cpu 13.832 total
```

The patch suppresses the following warnings:

```
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/vendor/mofile.rb:191: warning: assigned but unused variable - i
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:27: warning: method redefined; discarding old available_locales
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of available_locales was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:45: warning: method redefined; discarding old text_domain
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of text_domain was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:63: warning: method redefined; discarding old pluralisation_rule
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/storage.rb:15: warning: previous definition of pluralisation_rule was here
/home/kou/work/ruby/fast_gettext/lib/fast_gettext/translation.rb:30: warning: `*' interpreted as argument prefix
...
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/vendor/string_spec.rb:30: warning: `%' after local variable is interpreted as binary operator
/home/kou/work/ruby/fast_gettext/spec/fast_gettext/vendor/string_spec.rb:30: warning: even though it seems like string literal
```