From 7151f40062cb46b4f47598b1e324035808125d53 Mon Sep 17 00:00:00 2001 From: Jacob Kiesel Date: Mon, 9 Oct 2023 11:49:35 -0600 Subject: [PATCH] Improve error reporting --- src/checker.rs | 2 +- src/finder.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/checker.rs b/src/checker.rs index 2263121..9343fcc 100644 --- a/src/checker.rs +++ b/src/checker.rs @@ -40,7 +40,7 @@ impl Checker for ExistedChecker { file_type.is_file() || file_type.is_symlink() }) .unwrap_or(false) - && (path.extension().is_some() || matches_arch(&path)) + && (path.extension().is_some() || matches_arch(path)) } #[cfg(not(target_os = "windows"))] diff --git a/src/finder.rs b/src/finder.rs index b166578..45fcafe 100644 --- a/src/finder.rs +++ b/src/finder.rs @@ -83,7 +83,7 @@ impl Finder { } _ => { // Search binary in PATHs(defined in environment variable). - let p = paths.ok_or(Error::CannotFindBinaryPath)?; + let p = paths.ok_or(Error::CannotGetCurrentDirAndPathListEmpty)?; let paths: Vec<_> = env::split_paths(&p).collect(); Either::Right(Self::path_search_candidates(path, paths).into_iter()) @@ -105,7 +105,7 @@ impl Finder { where T: AsRef, { - let p = paths.ok_or(Error::CannotFindBinaryPath)?; + let p = paths.ok_or(Error::CannotGetCurrentDirAndPathListEmpty)?; // Collect needs to happen in order to not have to // change the API to borrow on `paths`. #[allow(clippy::needless_collect)]