summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-13 11:10:24 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-13 11:10:24 (GMT)
commit384fda18b885872aacf225ac6ad7805fb101e497 (patch)
tree4ce162ac23bd0b9a6e78a1f3c82fa57ea97480bf /array.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 'array.c')
-rw-r--r--array.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/array.c b/array.c
index 3c84a7b..8136052 100644
--- a/array.c
+++ b/array.c
@@ -5809,6 +5809,9 @@ rb_ary_any_p(int argc, VALUE *argv, VALUE ary)
rb_check_arity(argc, 0, 1);
if (!len) return Qfalse;
if (argc) {
+ if (rb_block_given_p()) {
+ rb_warn("given block not used");
+ }
for (i = 0; i < RARRAY_LEN(ary); ++i) {
if (RTEST(rb_funcall(argv[0], idEqq, 1, RARRAY_AREF(ary, i)))) return Qtrue;
}