From 6607938bf82771aff883b45859f614624eadb0d7 Mon Sep 17 00:00:00 2001 From: mo8it Date: Thu, 29 Feb 2024 23:10:09 +0100 Subject: Call as_ref only once --- helix-stdx/src/env.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'helix-stdx') 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>(binary_name: T) -> bool { pub fn which>( binary_name: T, ) -> Result { - 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, }) } -- cgit v1.2.3-70-g09d2