summaryrefslogtreecommitdiff
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
commit384fda18b885872aacf225ac6ad7805fb101e497 (patch)
tree4ce162ac23bd0b9a6e78a1f3c82fa57ea97480bf /hash.c
parentcff6bdfcba57995e1879c7a2003f9949aec29632 (diff)
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 d58e67c..32efd02 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);