1
0
Fork 0
mirror of https://github.com/helix-editor/helix synced 2024-05-21 04:06:06 +02:00

Call as_ref only once

This commit is contained in:
mo8it 2024-02-29 23:10:09 +01:00 committed by Blaž Hrastnik
parent 13533cb99c
commit 6607938bf8

View File

@ -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,
})
}