From daf6f04c02d07f9a221ae693e45941725238f2bc Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 11 Nov 2023 05:39:03 +0800 Subject: [PATCH] fix: Rust panics instead of returning an error when file times are invalid --- yazi-core/src/completion/commands/show.rs | 2 +- yazi-shared/src/cha.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/yazi-core/src/completion/commands/show.rs b/yazi-core/src/completion/commands/show.rs index e65ab28f..102df4bf 100644 --- a/yazi-core/src/completion/commands/show.rs +++ b/yazi-core/src/completion/commands/show.rs @@ -25,7 +25,7 @@ impl<'a> From<&'a Exec> for Opt<'a> { } impl Completion { - fn match_candidates(word: &str, cache: &Vec) -> Vec { + fn match_candidates(word: &str, cache: &[String]) -> Vec { let flow = cache.iter().try_fold( (Vec::with_capacity(LIMIT), Vec::with_capacity(LIMIT)), |(mut prefixed, mut fuzzy), s| { diff --git a/yazi-shared/src/cha.rs b/yazi-shared/src/cha.rs index e2170598..13cc0339 100644 --- a/yazi-shared/src/cha.rs +++ b/yazi-shared/src/cha.rs @@ -57,7 +57,7 @@ impl From for Cha { meta: cm, len: m.len(), accessed: m.accessed().ok(), - created: m.created().ok(), + created: std::panic::catch_unwind(|| m.created().ok()).ok().flatten(), modified: m.modified().ok(), #[cfg(unix)]