From: Eric Wong Date: Thu, 23 Jan 2020 23:05:57 +0000 (+0000) Subject: mid: shorten uniq_mids logic X-Git-Tag: v1.3.0~85 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=7d4858ea519cfe71cddc425ef4d39d6eea250b23 mid: shorten uniq_mids logic We won't be able to use List::Util::uniq here, but we can still shorten our logic and make it more consistent with the rest of our code which does similar things. --- diff --git a/lib/PublicInbox/MID.pm b/lib/PublicInbox/MID.pm index d7a42c38..33d5af74 100644 --- a/lib/PublicInbox/MID.pm +++ b/lib/PublicInbox/MID.pm @@ -120,9 +120,7 @@ sub uniq_mids ($;$) { warn "Message-ID: <$mid> too long, truncating\n"; $mid = substr($mid, 0, MAX_MID_SIZE); } - next if $seen->{$mid}; - push @ret, $mid; - $seen->{$mid} = 1; + push(@ret, $mid) unless $seen->{$mid}++; } \@ret; }