From 5be0286749697e21772c988ca99993580a8af60d Mon Sep 17 00:00:00 2001 From: Karey Higuera Date: Mon, 31 Aug 2020 16:20:53 -0500 Subject: [PATCH] deconstruct the TZ environment variable instead of unwrapping --- src/output/table.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/output/table.rs b/src/output/table.rs index 4392401..c80cfa4 100644 --- a/src/output/table.rs +++ b/src/output/table.rs @@ -287,11 +287,10 @@ impl Environment { } fn determine_time_zone() -> TZResult { - let tz = env::var("TZ"); - if tz.is_err() { - return TimeZone::from_file("/etc/localtime"); + if let Ok(file) = env::var("TZ") { + TimeZone::from_file(format!("/usr/share/zoneinfo/{}", file)) } else { - return TimeZone::from_file(format!("/usr/share/zoneinfo/{}", tz.unwrap())); + TimeZone::from_file("/etc/localtime") } }