fix: Rust panics instead of returning an error when file times are invalid

This commit is contained in:
sxyazi 2023-11-11 05:39:03 +08:00
parent 521c8b6bfe
commit daf6f04c02
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View file

@ -25,7 +25,7 @@ impl<'a> From<&'a Exec> for Opt<'a> {
} }
impl Completion { impl Completion {
fn match_candidates(word: &str, cache: &Vec<String>) -> Vec<String> { fn match_candidates(word: &str, cache: &[String]) -> Vec<String> {
let flow = cache.iter().try_fold( let flow = cache.iter().try_fold(
(Vec::with_capacity(LIMIT), Vec::with_capacity(LIMIT)), (Vec::with_capacity(LIMIT), Vec::with_capacity(LIMIT)),
|(mut prefixed, mut fuzzy), s| { |(mut prefixed, mut fuzzy), s| {

View file

@ -57,7 +57,7 @@ impl From<Metadata> for Cha {
meta: cm, meta: cm,
len: m.len(), len: m.len(),
accessed: m.accessed().ok(), accessed: m.accessed().ok(),
created: m.created().ok(), created: std::panic::catch_unwind(|| m.created().ok()).ok().flatten(),
modified: m.modified().ok(), modified: m.modified().ok(),
#[cfg(unix)] #[cfg(unix)]