mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
autodoc: Avoid a loop iteration
Initializing everything with the first elements values allows us to not look at that element again. Previously, only somethings were so initialized.
This commit is contained in:
parent
8d1c442397
commit
53c9fbf247
@ -1121,13 +1121,14 @@ sub docout ($$$) { # output the docs for one function
|
||||
# return type and arguments, only the main entry is displayed.
|
||||
# Also, find the longest return type and longest name so that if
|
||||
# multiple ones are shown, they can be vertically aligned nicely
|
||||
my $longest_ret = 0;
|
||||
my $longest_name_length = 0;
|
||||
my $need_individual_usage = 0;
|
||||
my $longest_name_length = length $items[0]->{name};
|
||||
my $base_ret_type = $items[0]->{ret_type};
|
||||
my $longest_ret = length $base_ret_type;
|
||||
my @base_args = $items[0]->{args}->@*;
|
||||
for my $item (@items) {
|
||||
for (my $i = 1; $i < @items; $i++) {
|
||||
no warnings 'experimental::smartmatch';
|
||||
my $item = $items[$i];
|
||||
$need_individual_usage = 1
|
||||
if $item->{ret_type} ne $base_ret_type
|
||||
|| ! ($item->{args}->@* ~~ @base_args);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user