From ee3c840f2f4169ebcf16753a10df5a10a08649de Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 31 Dec 2020 13:51:36 +0000 Subject: mid: use defined-or with `push' for uniqueness check As shown recently in commit a05445fb400108e60ede7d377cf3b26a0392eb24 ("config: config_fh_parse: micro-optimize"), the relying on the return value of `push' and defined-or operators can avoid modifying a the hash value scalar with an increment. --- lib/PublicInbox/MID.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/PublicInbox/MID.pm b/lib/PublicInbox/MID.pm index 5aeffb8c..601f4c9b 100644 --- a/lib/PublicInbox/MID.pm +++ b/lib/PublicInbox/MID.pm @@ -119,7 +119,7 @@ sub uniq_mids ($;$) { warn "Message-ID: <$mid> too long, truncating\n"; $mid = substr($mid, 0, MAX_MID_SIZE); } - push(@ret, $mid) unless $seen->{$mid}++; + $seen->{$mid} //= push(@ret, $mid); } \@ret; } -- cgit v1.2.3-24-ge0c7