summaryrefslogtreecommitdiffstats
path: root/perl_checker.src/parser_helper.ml
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-10-13 07:34:40 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-10-13 07:34:40 +0000
commit74726fadba591e6656158454a0aba96d3324e6c1 (patch)
tree25ee350985a727ee90d002dc8f99ed995036aeed /perl_checker.src/parser_helper.ml
parentd1ec317d8b4153158bf12d79bfec0a581b7817db (diff)
downloadperl_checker-74726fadba591e6656158454a0aba96d3324e6c1.tar
perl_checker-74726fadba591e6656158454a0aba96d3324e6c1.tar.gz
perl_checker-74726fadba591e6656158454a0aba96d3324e6c1.tar.bz2
perl_checker-74726fadba591e6656158454a0aba96d3324e6c1.tar.xz
perl_checker-74726fadba591e6656158454a0aba96d3324e6c1.zip
you can replace "any { $_ eq ... } @l" with "member(..., @l)"
Diffstat (limited to 'perl_checker.src/parser_helper.ml')
-rw-r--r--perl_checker.src/parser_helper.ml10
1 files changed, 9 insertions, 1 deletions
diff --git a/perl_checker.src/parser_helper.ml b/perl_checker.src/parser_helper.ml
index 858dd80..40120ee 100644
--- a/perl_checker.src/parser_helper.ml
+++ b/perl_checker.src/parser_helper.ml
@@ -891,9 +891,17 @@ let call_raw force_non_builtin_func (e, para) =
warn_rule "you can replace \"grep { member($_, ...) } @l\" with \"intersection([ @l ], [ ... ])\""
| _ -> check_anonymous_block f para)
+ | "any" ->
+ (match para with
+ [Anonymous_sub (None, Block
+ [ List [ Call_op("eq", [Deref(I_scalar, Ident(None, "_", _)); _ ], _) ] ],
+ _); _ ] ->
+ warn_rule "you can replace \"any { $_ eq ... } @l\" with \"member(..., @l)\""
+ | _ -> check_anonymous_block f para)
+
| "grep_index" | "map_index" | "partition" | "uniq_"
| "find"
- | "any" | "every"
+ | "every"
| "find_index"
| "each_index" -> check_anonymous_block f para