From 820b41a7ef55c7300b8b12a83b0786c98463ed5e Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Sat, 9 Oct 2021 11:40:31 +0100 Subject: [PATCH] Redo "Bad" enum as Invalid without internal data --- src/meta/date.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/meta/date.rs b/src/meta/date.rs index 4df2edd..b76aa8d 100644 --- a/src/meta/date.rs +++ b/src/meta/date.rs @@ -9,7 +9,7 @@ use std::time::SystemTime; #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum Date { Date(DateTime), - Bad(String), + Invalid, } // Note that this is split from the From for Metadata so we can test this one (as we can't mock Metadata) @@ -21,7 +21,7 @@ impl<'a> From for Date { if let Ok(time) = res { Date::Date(time) } else { - Date::Bad(format!("Bad {:?}", res)) + Date::Invalid } } } @@ -68,7 +68,7 @@ impl Date { DateFlag::Formatted(format) => val.format(format).to_string(), } } else { - String::from("invalid time") + String::from("-") } } } @@ -322,7 +322,7 @@ mod test { flags.date = DateFlag::Date; assert_eq!( - "invalid time".to_string().with(Color::AnsiValue(36)), + "-".to_string().with(Color::AnsiValue(36)), date.render(&colors, &flags) ); }