diff --git a/yazi-core/src/input/input.rs b/yazi-core/src/input/input.rs index 66e0a946..39f9aafd 100644 --- a/yazi-core/src/input/input.rs +++ b/yazi-core/src/input/input.rs @@ -212,13 +212,8 @@ impl Input { self.completion.close(); } } - } else { - match key { - Key { code: KeyCode::Tab, shift: false, ctrl: false, alt: false } => { - return self.complete(); - } - _ => (), - } + } else if matches!(key, Key { code: KeyCode::Tab, shift: false, ctrl: false, alt: false }) { + return self.complete(); } if let Some(c) = key.plain() { diff --git a/yazi-core/src/tab/commands/cd.rs b/yazi-core/src/tab/commands/cd.rs index ade0361c..4c98f92d 100644 --- a/yazi-core/src/tab/commands/cd.rs +++ b/yazi-core/src/tab/commands/cd.rs @@ -74,24 +74,21 @@ impl Tab { .map(|list| { list .filter_map(|file| { - file - .ok() - .map(|f| { - let name = f.file_name().to_string_lossy().to_string(); - if f.metadata().is_ok_and(|m| m.is_dir()) && name.starts_with(&cmp_prefix) { - Some(name) - } else { - None - } - }) - .flatten() + file.ok().and_then(|f| { + let name = f.file_name().to_string_lossy().to_string(); + if f.metadata().is_ok_and(|m| m.is_dir()) && name.starts_with(cmp_prefix) { + Some(name) + } else { + None + } + }) }) .collect() }) .unwrap_or_default() }, |current, new| { - if let Some((prefix, _)) = current.rsplit_once("/") { + if let Some((prefix, _)) = current.rsplit_once('/') { format!("{prefix}/{new}/") } else { format!("{new}/")