From 7d4858ea519cfe71cddc425ef4d39d6eea250b23 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 Jan 2020 23:05:57 +0000 Subject: [PATCH] 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. --- lib/PublicInbox/MID.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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; } -- 2.44.0