From 24213cf1350b1dbcbcaf108c34d5b8a7bb252060 Mon Sep 17 00:00:00 2001 From: Wang Tong Date: Tue, 28 Feb 2023 17:17:19 +0800 Subject: [PATCH] fix warning of deprecated function use. --- src/logs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logs.rs b/src/logs.rs index 5e17c67..b2b3ff8 100644 --- a/src/logs.rs +++ b/src/logs.rs @@ -34,7 +34,7 @@ pub fn remove_old(log_folder: &Path) -> Result<(), Error> { } let file_stem = path.file_stem().unwrap().to_string_lossy(); let log_time = match NaiveDate::parse_from_str(&file_stem, "%Y-%m-%d") { - Ok(d) => d.and_hms(0, 0, 0), + Ok(d) => d.and_hms_opt(0, 0, 0).unwrap(), Err(_) => continue, }; if log_time < deletion_point {