Skip to content

Commit 4310bf8

Browse files
committed
🚧 temporarily allow deprecated duration
will fix in next release Signed-off-by: Wei Zhang <kweizh@gmail.com>
1 parent 7ad1be8 commit 4310bf8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/meta/date.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ impl From<&Metadata> for Date {
3434
impl Date {
3535
pub fn render(&self, colors: &Colors, flags: &Flags) -> ColoredString {
3636
let now = Local::now();
37+
#[allow(deprecated)]
3738
let elem = match self {
3839
&Date::Date(modified) if modified > now - Duration::hours(1) => Elem::HourOld,
3940
&Date::Date(modified) if modified > now - Duration::days(1) => Elem::DayOld,
@@ -46,6 +47,7 @@ impl Date {
4647
let locale = current_locale();
4748

4849
if let Date::Date(val) = self {
50+
#[allow(deprecated)]
4951
match &flags.date {
5052
DateFlag::Date => val.format("%c").to_string(),
5153
DateFlag::Locale => val.format_localized("%c", locale).to_string(),
@@ -119,6 +121,7 @@ mod test {
119121
let mut file_path = env::temp_dir();
120122
file_path.push("test_an_hour_old_file_color.tmp");
121123

124+
#[allow(deprecated)]
122125
let creation_date = Local::now() - chrono::Duration::seconds(4);
123126

124127
let success = cross_platform_touch(&file_path, &creation_date)
@@ -146,6 +149,7 @@ mod test {
146149
let mut file_path = env::temp_dir();
147150
file_path.push("test_a_day_old_file_color.tmp");
148151

152+
#[allow(deprecated)]
149153
let creation_date = Local::now() - chrono::Duration::hours(4);
150154

151155
let success = cross_platform_touch(&file_path, &creation_date)
@@ -173,6 +177,7 @@ mod test {
173177
let mut file_path = env::temp_dir();
174178
file_path.push("test_a_several_days_old_file_color.tmp");
175179

180+
#[allow(deprecated)]
176181
let creation_date = Local::now() - chrono::Duration::days(2);
177182

178183
let success = cross_platform_touch(&file_path, &creation_date)
@@ -200,6 +205,7 @@ mod test {
200205
let mut file_path = env::temp_dir();
201206
file_path.push("test_with_relative_date.tmp");
202207

208+
#[allow(deprecated)]
203209
let creation_date = Local::now() - chrono::Duration::days(2);
204210

205211
let success = cross_platform_touch(&file_path, &creation_date)
@@ -285,6 +291,7 @@ mod test {
285291
let mut file_path = env::temp_dir();
286292
file_path.push("test_iso_format_year_old.tmp");
287293

294+
#[allow(deprecated)]
288295
let creation_date = Local::now() - Duration::days(400);
289296
let success = cross_platform_touch(&file_path, &creation_date)
290297
.unwrap()

0 commit comments

Comments
 (0)