diff options
author | Eric Wong <e@yhbt.net> | 2020-01-23 23:05:55 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-01-24 23:04:52 +0000 |
commit | ea45e9f71588572a2f4b9299a86cedc3c8e9c72a (patch) | |
tree | c1755abdd64024892b313dbf7aca97105566d79c /lib | |
parent | 261f705649bf5bc9c1954b29cfdb3c894cf44be2 (diff) | |
download | public-inbox-ea45e9f71588572a2f4b9299a86cedc3c8e9c72a.tar.gz |
We can cut down on the number of operations required using "grep" instead of "foreach".
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/NNTP.pm | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 35729f00..12f74c3d 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -423,10 +423,7 @@ sub set_nntp_headers ($$$$$) { $hdr->header_set('Message-ID', $mid0); my @alt = $hdr->header('X-Alt-Message-ID'); my %seen = map { $_ => 1 } (@alt, $mid0); - foreach my $m (@mids) { - next if $seen{$m}++; - push @alt, $m; - } + push(@alt, grep { !$seen{$_}++ } @mids); $hdr->header_set('X-Alt-Message-ID', @alt); } |