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,14 +212,9 @@ 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 {
Key { code: KeyCode::Tab, shift: false, ctrl: false, alt: false } => {
return self.complete(); return self.complete();
} }
_ => (),
}
}
if let Some(c) = key.plain() { if let Some(c) = key.plain() {
return self.type_char(c); return self.type_char(c);

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()
.map(|f| {
let name = f.file_name().to_string_lossy().to_string(); 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) { if f.metadata().is_ok_and(|m| m.is_dir()) && name.starts_with(cmp_prefix) {
Some(name) Some(name)
} else { } else {
None 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}/")