Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Feb 3, 2025
1 parent 74e4da7 commit 38747c4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions crates/shell/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn complete_filenames(is_start: bool, word: &str, matches: &mut Vec<Pair>) {
};

let search_dir = resolve_dir_path(dir_path);
let only_executable = (word.starts_with("./") || word.starts_with("/")) && is_start;
let only_executable = (word.starts_with("./") || word.starts_with('/')) && is_start;

let files: Vec<FileMatch> = fs::read_dir(&search_dir)
.into_iter()
Expand All @@ -176,7 +176,7 @@ fn complete_filenames(is_start: bool, word: &str, matches: &mut Vec<Pair>) {

matches.extend(files.into_iter().map(|f| Pair {
display: f.display_name(),
replacement: f.replacement(&dir_path),
replacement: f.replacement(dir_path),
}));
}

Expand Down Expand Up @@ -210,13 +210,14 @@ fn complete_executables_in_path(is_start: bool, word: &str, matches: &mut Vec<Pa
if let Ok(entries) = fs::read_dir(path) {
for entry in entries.flatten() {
if let Ok(name) = entry.file_name().into_string() {
if name.starts_with(word) && entry.path().is_file() {
if found.insert(name.clone()) {
matches.push(Pair {
display: name.clone(),
replacement: name,
});
}
if name.starts_with(word)
&& entry.path().is_file()
&& found.insert(name.clone())
{
matches.push(Pair {
display: name.clone(),
replacement: name,
});
}
}
}
Expand Down

0 comments on commit 38747c4

Please sign in to comment.