We don't need multiple return points nor multiple time_response
calls in either function.
---
 lib/PublicInbox/MsgTime.pm | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/lib/PublicInbox/MsgTime.pm b/lib/PublicInbox/MsgTime.pm
index 58b0deae..bbc9a007 100644
--- a/lib/PublicInbox/MsgTime.pm
+++ b/lib/PublicInbox/MsgTime.pm
@@ -157,20 +157,16 @@ sub msg_date_only ($) {
 
 # Favors Received header for sorting globally
 sub msg_timestamp ($;$) {
-       my ($hdr, $fallback) = @_; # PublicInbox::Eml
-       my $ret;
-       $ret = msg_received_at($hdr) and return time_response($ret);
-       $ret = msg_date_only($hdr) and return time_response($ret);
-       time_response([ $fallback // time, '+0000' ]);
+       my ($eml, $fallback) = @_;
+       time_response(msg_received_at($eml) // msg_date_only($eml) //
+                       [ $fallback // time, '+0000' ]);
 }
 
 # Favors the Date: header for display and sorting within a thread
 sub msg_datestamp ($;$) {
-       my ($hdr, $fallback) = @_; # PublicInbox::Eml
-       my $ret;
-       $ret = msg_date_only($hdr) and return time_response($ret);
-       $ret = msg_received_at($hdr) and return time_response($ret);
-       time_response([ $fallback // time, '+0000' ]);
+       my ($eml, $fallback) = @_; # PublicInbox::Eml
+       time_response(msg_date_only($eml) // msg_received_at($eml) //
+                       [ $fallback // time, '+0000' ]);
 }
 
 1;

Reply via email to