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:
Karl Williamson 2020-09-05 16:40:17 -06:00
parent 8d1c442397
commit 53c9fbf247

View File

@ -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);