diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-10 16:52:19 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-10 16:52:19 +0800 |
| commit | 02e07a18fcb3af9319c271f6e41d5b7785e2e436 (patch) | |
| tree | ff76916c254e87a7aadc5cb4dfd2134eaf4f03fc /arg_picker/src/builtin/pick_paths.rs | |
| parent | 03b487f0f93ac32835149d4c1a0fb420341134f8 (diff) | |
style: satisfy clippy pedantic and nursery lints
Diffstat (limited to 'arg_picker/src/builtin/pick_paths.rs')
| -rw-r--r-- | arg_picker/src/builtin/pick_paths.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/arg_picker/src/builtin/pick_paths.rs b/arg_picker/src/builtin/pick_paths.rs index 8e6c0fd..954464b 100644 --- a/arg_picker/src/builtin/pick_paths.rs +++ b/arg_picker/src/builtin/pick_paths.rs @@ -17,7 +17,7 @@ impl SinglePickable for FilePath { match <PathBuf as SinglePickable>::pick_single(str) { Parsed(path) => { if path.exists() && path.is_file() { - Parsed(FilePath::from(path)) + Parsed(Self::from(path)) } else { NotFound } @@ -33,7 +33,7 @@ impl SinglePickable for NoFilePath { match <PathBuf as SinglePickable>::pick_single(str) { Parsed(path) => { if !path.exists() || !path.is_file() { - Parsed(NoFilePath::from(path)) + Parsed(Self::from(path)) } else { NotFound } @@ -49,7 +49,7 @@ impl SinglePickable for DirPath { match <PathBuf as SinglePickable>::pick_single(str) { Parsed(path) => { if path.exists() && path.is_dir() { - Parsed(DirPath::from(path)) + Parsed(Self::from(path)) } else { NotFound } @@ -65,7 +65,7 @@ impl SinglePickable for NoDirPath { match <PathBuf as SinglePickable>::pick_single(str) { Parsed(path) => { if !path.exists() || !path.is_dir() { - Parsed(NoDirPath::from(path)) + Parsed(Self::from(path)) } else { NotFound } @@ -81,7 +81,7 @@ impl SinglePickable for SymlinkPath { match <PathBuf as SinglePickable>::pick_single(str) { Parsed(path) => { if path.exists() && path.is_symlink() { - Parsed(SymlinkPath::from(path)) + Parsed(Self::from(path)) } else { NotFound } @@ -97,7 +97,7 @@ impl SinglePickable for NoSymlinkPath { match <PathBuf as SinglePickable>::pick_single(str) { Parsed(path) => { if !path.exists() || !path.is_symlink() { - Parsed(NoSymlinkPath::from(path)) + Parsed(Self::from(path)) } else { NotFound } @@ -112,10 +112,10 @@ impl SinglePickable for NoPath { fn pick_single(str: Option<&str>) -> PickerArgResult<Self> { match <PathBuf as SinglePickable>::pick_single(str) { Parsed(path) => { - if !path.exists() { - Parsed(NoPath::from(path)) - } else { + if path.exists() { NotFound + } else { + Parsed(Self::from(path)) } } Unparsed => Unparsed, @@ -132,7 +132,7 @@ impl SinglePickable for RecursiveFiles { return NotFound; } if path.is_file() || path.is_symlink() { - return Parsed(RecursiveFiles::from(vec![path])); + return Parsed(Self::from(vec![path])); } let mut entries = Vec::new(); if let Ok(dir_entries) = fs::read_dir(&path) { @@ -145,7 +145,7 @@ impl SinglePickable for RecursiveFiles { } } } - Parsed(RecursiveFiles::from(entries)) + Parsed(Self::from(entries)) } Unparsed => Unparsed, NotFound => NotFound, |
