summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/meta/date.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/meta/date.rs b/src/meta/date.rs
index e7ded16..007023c 100644
--- a/src/meta/date.rs
+++ b/src/meta/date.rs
@@ -34,6 +34,7 @@ impl From<&Metadata> for Date {
impl Date {
pub fn render(&self, colors: &Colors, flags: &Flags) -> ColoredString {
let now = Local::now();
+ #[allow(deprecated)]
let elem = match self {
&Date::Date(modified) if modified > now - Duration::hours(1) => Elem::HourOld,
&Date::Date(modified) if modified > now - Duration::days(1) => Elem::DayOld,
@@ -46,6 +47,7 @@ impl Date {
let locale = current_locale();
if let Date::Date(val) = self {
+ #[allow(deprecated)]
match &flags.date {
DateFlag::Date => val.format("%c").to_string(),
DateFlag::Locale => val.format_localized("%c", locale).to_string(),
@@ -119,6 +121,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_an_hour_old_file_color.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - chrono::Duration::seconds(4);
let success = cross_platform_touch(&file_path, &creation_date)
@@ -146,6 +149,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_a_day_old_file_color.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - chrono::Duration::hours(4);
let success = cross_platform_touch(&file_path, &creation_date)
@@ -173,6 +177,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_a_several_days_old_file_color.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - chrono::Duration::days(2);
let success = cross_platform_touch(&file_path, &creation_date)
@@ -200,6 +205,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_with_relative_date.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - chrono::Duration::days(2);
let success = cross_platform_touch(&file_path, &creation_date)
@@ -285,6 +291,7 @@ mod test {
let mut file_path = env::temp_dir();
file_path.push("test_iso_format_year_old.tmp");
+ #[allow(deprecated)]
let creation_date = Local::now() - Duration::days(400);
let success = cross_platform_touch(&file_path, &creation_date)
.unwrap()