aboutsummaryrefslogtreecommitdiff
path: root/arg_picker/src/builtin/pick_pathbuf.rs
diff options
context:
space:
mode:
Diffstat (limited to 'arg_picker/src/builtin/pick_pathbuf.rs')
-rw-r--r--arg_picker/src/builtin/pick_pathbuf.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/arg_picker/src/builtin/pick_pathbuf.rs b/arg_picker/src/builtin/pick_pathbuf.rs
index 3bd4410..2b48e3d 100644
--- a/arg_picker/src/builtin/pick_pathbuf.rs
+++ b/arg_picker/src/builtin/pick_pathbuf.rs
@@ -7,12 +7,8 @@ use crate::{
impl SinglePickable for PathBuf {
fn pick_single(str: Option<&str>) -> crate::PickerArgResult<Self> {
- match str {
- Some(str) => match just_fmt::fmt_path_str(str) {
- Ok(formated) => Parsed(PathBuf::from(formated)),
- Err(_) => NotFound,
- },
- None => NotFound,
- }
+ str.map_or(NotFound, |str| {
+ just_fmt::fmt_path_str(str).map_or(NotFound, |formated| Parsed(Self::from(formated)))
+ })
}
}