aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-13 11:10:24 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-13 11:10:24 +0000
commit3260c6fb3771ec6150fcc53c0b4481c145fba043 (patch)
tree4ce162ac23bd0b9a6e78a1f3c82fa57ea97480bf /hash.c
parent2c42f43d1191d7d8613854274024f0375742a639 (diff)
downloadruby-3260c6fb3771ec6150fcc53c0b4481c145fba043.tar.gz
warn unused blocks with Enumerable#all? any? one? none?
[Fix GH-1953] From: Koji Onishi <fursich0@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index d58e67cf87..32efd02d5a 100644
--- a/hash.c
+++ b/hash.c
@@ -3034,6 +3034,9 @@ rb_hash_any_p(int argc, VALUE *argv, VALUE hash)
rb_check_arity(argc, 0, 1);
if (RHASH_EMPTY_P(hash)) return Qfalse;
if (argc) {
+ if (rb_block_given_p()) {
+ rb_warn("given block not used");
+ }
args[1] = argv[0];
rb_hash_foreach(hash, any_p_i_pattern, (VALUE)args);