Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
resolve clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Mar 5, 2022
1 parent 80a703b commit 1333fb8
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions src/finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,25 @@ pub fn find(items: &[DirItem]) -> Option<String> {

let items = receiver(items);

Skim::run_with(&skim_options, Some(items))
.map(|out| {
let selected = out.selected_items.first();
let selected = match selected {
Some(item) => {
let selected_dir = (**item).as_any().downcast_ref::<DirItem>().unwrap();
Some(selected_dir)
}
None => None,
};

if let Some(selected) = selected {
let final_key = out.final_key;
let path = selected.path.to_str().unwrap().to_string();
final_key.handle(path.clone());
return final_key
.result_prefix()
.map(|prefix| Some(format!("{}{}", prefix, path)))
.flatten();
Skim::run_with(&skim_options, Some(items)).and_then(|out| {
let selected = out.selected_items.first();
let selected = match selected {
Some(item) => {
let selected_dir = (**item).as_any().downcast_ref::<DirItem>().unwrap();
Some(selected_dir)
}
None => None,
};

None
})
.flatten()
if let Some(selected) = selected {
let final_key = out.final_key;
let path = selected.path.to_str().unwrap().to_string();
final_key.handle(path.clone());
return final_key
.result_prefix()
.map(|prefix| format!("{}{}", prefix, path));
}

None
})
}

0 comments on commit 1333fb8

Please sign in to comment.