From 1fc164b843a783d578dbc7b4d26e7b30924f7ea1 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Thu, 5 Sep 2024 14:29:15 -0700 Subject: [PATCH] remove unused code --- lib/Perl/Tidy/Formatter.pm | 49 ++++++++++++-------------------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 2e5d2a6c..929b0a59 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -10526,20 +10526,22 @@ EOM } ## end sub dump_unusual_variables sub initialize_warn_hash { - my ( $long_name, $default, $rall_opts, $wvt_in_args ) = @_; + my ( $long_name, $default, $rall_opts ) = @_; # Given: # $long_name = full option name # $default = default value # $rall_opts = all possible options - # $wvt_in_args = special flag for --warn-variable-types only # Return the corresponding option hash # Example of all possible options for --warn-variable-types=s # r - reused scope # s - reused sigil # p - package boundaries crossed by lexical variables - # u - only if -wvt and filename(s) are on command line; see git #151 + # u - unused lexical variable defined by my, state, our + # c - unused constant defined by use constant + + # Other warn options use different letters # Other controls: # 0 - none of the above @@ -10549,8 +10551,6 @@ sub initialize_warn_hash { # Example: # -wvt='s r' : do check types 's' and 'r' - # Other warn options use different letters - my $rwarn_hash = {}; if ( !$rall_opts || !@{$rall_opts} ) { @@ -10588,7 +10588,7 @@ sub initialize_warn_hash { return $rwarn_hash; } else { - # should be one of r,s,p, maybe u - catch any error below + # should be one of the allowed letters - catch any error below } } @@ -10596,34 +10596,16 @@ sub initialize_warn_hash { foreach my $opt (@opts) { if ( $is_valid_option{$opt} ) { $rwarn_hash->{$opt} = 1; + next; } - else { - if ( $opt =~ /^[01\*]$/ ) { - $msg .= - "--$long_name cannot contain $opt mixed with other options\n"; - } - # Special check for -wvt - # Deactivated for now to allow -wvt in perltidyrc files. This can - # eventually be removed if allowing this does not cause problems. - elsif ( 0 - && ( $opt eq 'u' || $opt eq 'c' ) - && $long_name eq 'warn-variable-types' ) - { - if ( !$wvt_in_args ) { - Warn(<