From 8434429f256d7690bf2704489ed92fc5ed64cbe6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 17 Mar 2026 01:07:24 -0700 Subject: [PATCH] Match Go TTL Display: return empty string when unit is Empty Go checks `t.Unit == Empty` separately and returns "" for TTLs with nonzero count but Empty unit. Rust only checked is_empty() (count==0 && unit==0), so count>0 with unit=0 would format as "5 " instead of "". --- seaweed-volume/src/storage/needle/ttl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seaweed-volume/src/storage/needle/ttl.rs b/seaweed-volume/src/storage/needle/ttl.rs index 38defa69d..dcf0ab9c8 100644 --- a/seaweed-volume/src/storage/needle/ttl.rs +++ b/seaweed-volume/src/storage/needle/ttl.rs @@ -187,7 +187,7 @@ fn unit_to_char(unit: u8) -> char { impl fmt::Display for TTL { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if self.is_empty() { + if self.count == 0 || self.unit == TTL_UNIT_EMPTY { return write!(f, ""); } write!(f, "{}{}", self.count, unit_to_char(self.unit))