summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-06-29 09:48:32 +0900
committerGitHub <[email protected]>2021-06-29 09:48:32 +0900
commitf05f6963f87ac6632f5048575e9f0f76cc769a5a (patch)
tree5afc2fafbbff2d543222c2f51731fa04690138f6
parentd63c0df6bcd5851522c4b982dba4e0a93f44a2d7 (diff)
parent2d0b50f6f37ae4707ae1b9e34a9961620654bc66 (diff)
downloadmruby-f05f6963f87ac6632f5048575e9f0f76cc769a5a.tar.gz
mruby-f05f6963f87ac6632f5048575e9f0f76cc769a5a.zip
Merge pull request #5498 from dearblue/ruby-warns
Avoid warnings with `ruby -cw`
-rw-r--r--mrbgems/mruby-array-ext/mrblib/array.rb2
-rw-r--r--mrbgems/mruby-hash-ext/mrblib/hash.rb2
-rw-r--r--mrbgems/mruby-io/mrblib/io.rb4
-rw-r--r--mrbgems/mruby-string-ext/mrblib/string.rb2
-rw-r--r--mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb2
5 files changed, 3 insertions, 9 deletions
diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb
index 7fbb948d2..7520b932f 100644
--- a/mrbgems/mruby-array-ext/mrblib/array.rb
+++ b/mrbgems/mruby-array-ext/mrblib/array.rb
@@ -386,7 +386,6 @@ class Array
end
beg = len = 0
- ary = []
if block
if arg0.nil? && arg1.nil? && arg2.nil?
# ary.fill { |index| block } -> ary
@@ -660,7 +659,6 @@ class Array
return to_enum :keep_if unless block
idx = 0
- len = self.size
while idx < self.size do
if block.call(self[idx])
idx += 1
diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb
index 33e2dcb9f..5775913c3 100644
--- a/mrbgems/mruby-hash-ext/mrblib/hash.rb
+++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb
@@ -116,7 +116,6 @@ class Hash
nk.each {|k|
h[k] = self[k]
}
- h
self.replace(h)
end
@@ -256,7 +255,6 @@ class Hash
def keep_if(&block)
return to_enum :keep_if unless block
- keys = []
self.each do |k, v|
unless block.call([k, v])
self.delete(k)
diff --git a/mrbgems/mruby-io/mrblib/io.rb b/mrbgems/mruby-io/mrblib/io.rb
index 645733226..006578222 100644
--- a/mrbgems/mruby-io/mrblib/io.rb
+++ b/mrbgems/mruby-io/mrblib/io.rb
@@ -209,7 +209,7 @@ class IO
end
array = []
- while 1
+ while true
begin
_read_buf
rescue EOFError
@@ -256,7 +256,7 @@ class IO
end
array = []
- while 1
+ while true
begin
_read_buf
rescue EOFError
diff --git a/mrbgems/mruby-string-ext/mrblib/string.rb b/mrbgems/mruby-string-ext/mrblib/string.rb
index 84d566fda..4f533c4cd 100644
--- a/mrbgems/mruby-string-ext/mrblib/string.rb
+++ b/mrbgems/mruby-string-ext/mrblib/string.rb
@@ -344,8 +344,6 @@ class String
end
def codepoints(&block)
- len = self.size
-
if block_given?
self.split('').each do|x|
block.call(x.ord)
diff --git a/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb b/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb
index 774562398..664008d1c 100644
--- a/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb
+++ b/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb
@@ -1,5 +1,5 @@
-def self.include (*modules)
+def self.include(*modules)
self.class.include(*modules)
end