chore: fix clippy

This commit is contained in:
XOR-op 2023-10-26 23:41:30 -04:00
parent fd81366de8
commit 4093000b21
2 changed files with 11 additions and 19 deletions

View file

@ -212,13 +212,8 @@ impl Input {
self.completion.close(); self.completion.close();
} }
} }
} else { } else if matches!(key, Key { code: KeyCode::Tab, shift: false, ctrl: false, alt: false }) {
match key { return self.complete();
Key { code: KeyCode::Tab, shift: false, ctrl: false, alt: false } => {
return self.complete();
}
_ => (),
}
} }
if let Some(c) = key.plain() { if let Some(c) = key.plain() {

View file

@ -74,24 +74,21 @@ impl Tab {
.map(|list| { .map(|list| {
list list
.filter_map(|file| { .filter_map(|file| {
file file.ok().and_then(|f| {
.ok() let name = f.file_name().to_string_lossy().to_string();
.map(|f| { if f.metadata().is_ok_and(|m| m.is_dir()) && name.starts_with(cmp_prefix) {
let name = f.file_name().to_string_lossy().to_string(); Some(name)
if f.metadata().is_ok_and(|m| m.is_dir()) && name.starts_with(&cmp_prefix) { } else {
Some(name) None
} else { }
None })
}
})
.flatten()
}) })
.collect() .collect()
}) })
.unwrap_or_default() .unwrap_or_default()
}, },
|current, new| { |current, new| {
if let Some((prefix, _)) = current.rsplit_once("/") { if let Some((prefix, _)) = current.rsplit_once('/') {
format!("{prefix}/{new}/") format!("{prefix}/{new}/")
} else { } else {
format!("{new}/") format!("{new}/")