aboutsummaryrefslogtreecommitdiff
path: root/helix-stdx
diff options
context:
space:
mode:
authormo8it2024-02-29 22:10:09 +0000
committerBlaž Hrastnik2024-03-19 05:39:46 +0000
commit6607938bf82771aff883b45859f614624eadb0d7 (patch)
tree4de5c4d0430de9cc65d6fe81591ff8e92d948691 /helix-stdx
parent13533cb99c2a14d9661a3570c346f4cd3ceae777 (diff)
Call as_ref only once
Diffstat (limited to 'helix-stdx')
-rw-r--r--helix-stdx/src/env.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-stdx/src/env.rs b/helix-stdx/src/env.rs
index 90a0aee8..59aba0ad 100644
--- a/helix-stdx/src/env.rs
+++ b/helix-stdx/src/env.rs
@@ -42,8 +42,9 @@ pub fn binary_exists<T: AsRef<OsStr>>(binary_name: T) -> bool {
pub fn which<T: AsRef<OsStr>>(
binary_name: T,
) -> Result<std::path::PathBuf, ExecutableNotFoundError> {
- which::which(binary_name.as_ref()).map_err(|err| ExecutableNotFoundError {
- command: binary_name.as_ref().to_string_lossy().into_owned(),
+ let binary_name = binary_name.as_ref();
+ which::which(binary_name).map_err(|err| ExecutableNotFoundError {
+ command: binary_name.to_string_lossy().into_owned(),
inner: err,
})
}