Commit 2d0b50f6 authored by dearblue's avatar dearblue

Avoid warnings with `ruby -cw`

```console
% for rb in `git ls-files '*/mrblib/*.rb' 'mrblib'`; do ruby30 -cw $rb > /dev/null; done
mrbgems/mruby-array-ext/mrblib/array.rb:389: warning: assigned but unused variable - ary
mrbgems/mruby-array-ext/mrblib/array.rb:663: warning: assigned but unused variable - len
mrbgems/mruby-hash-ext/mrblib/hash.rb:119: warning: possibly useless use of a variable in void context
mrbgems/mruby-hash-ext/mrblib/hash.rb:259: warning: assigned but unused variable - keys
mrbgems/mruby-io/mrblib/io.rb:229: warning: literal in condition
mrbgems/mruby-io/mrblib/io.rb:280: warning: literal in condition
mrbgems/mruby-string-ext/mrblib/string.rb:347: warning: assigned but unused variable - len
mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb:2: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument
```
parent d63c0df6
...@@ -386,7 +386,6 @@ class Array ...@@ -386,7 +386,6 @@ class Array
end end
beg = len = 0 beg = len = 0
ary = []
if block if block
if arg0.nil? && arg1.nil? && arg2.nil? if arg0.nil? && arg1.nil? && arg2.nil?
# ary.fill { |index| block } -> ary # ary.fill { |index| block } -> ary
...@@ -660,7 +659,6 @@ class Array ...@@ -660,7 +659,6 @@ class Array
return to_enum :keep_if unless block return to_enum :keep_if unless block
idx = 0 idx = 0
len = self.size
while idx < self.size do while idx < self.size do
if block.call(self[idx]) if block.call(self[idx])
idx += 1 idx += 1
......
...@@ -116,7 +116,6 @@ class Hash ...@@ -116,7 +116,6 @@ class Hash
nk.each {|k| nk.each {|k|
h[k] = self[k] h[k] = self[k]
} }
h
self.replace(h) self.replace(h)
end end
...@@ -256,7 +255,6 @@ class Hash ...@@ -256,7 +255,6 @@ class Hash
def keep_if(&block) def keep_if(&block)
return to_enum :keep_if unless block return to_enum :keep_if unless block
keys = []
self.each do |k, v| self.each do |k, v|
unless block.call([k, v]) unless block.call([k, v])
self.delete(k) self.delete(k)
......
...@@ -209,7 +209,7 @@ class IO ...@@ -209,7 +209,7 @@ class IO
end end
array = [] array = []
while 1 while true
begin begin
_read_buf _read_buf
rescue EOFError rescue EOFError
...@@ -256,7 +256,7 @@ class IO ...@@ -256,7 +256,7 @@ class IO
end end
array = [] array = []
while 1 while true
begin begin
_read_buf _read_buf
rescue EOFError rescue EOFError
......
...@@ -344,8 +344,6 @@ class String ...@@ -344,8 +344,6 @@ class String
end end
def codepoints(&block) def codepoints(&block)
len = self.size
if block_given? if block_given?
self.split('').each do|x| self.split('').each do|x|
block.call(x.ord) block.call(x.ord)
......
def self.include (*modules) def self.include(*modules)
self.class.include(*modules) self.class.include(*modules)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment