From e3ee44b1c4c9dbf141ffc5fddfbfda2473adcf00 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Tue, 27 Aug 2024 23:48:30 +0200 Subject: [PATCH] fix: prefer from trait over into --- src/file_builders/active_runtime_json.rs | 1 + src/profile.rs | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/file_builders/active_runtime_json.rs b/src/file_builders/active_runtime_json.rs index 4a8dd5d..62e9142 100644 --- a/src/file_builders/active_runtime_json.rs +++ b/src/file_builders/active_runtime_json.rs @@ -139,6 +139,7 @@ pub fn set_current_active_runtime_to_profile(profile: &Profile) -> anyhow::Resul let dest = get_active_runtime_json_path(); set_file_readonly(&dest, false)?; backup_steam_active_runtime(); + // TODO: need to escape path spaces here? let pfx = profile.clone().prefix; let mut ar = build_profile_active_runtime(profile)?; // hack: relativize libopenxr_monado.so path for system installs diff --git a/src/profile.rs b/src/profile.rs index 6fe83b2..77e88f6 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -62,11 +62,11 @@ impl From for XRServiceType { } } -impl Into for XRServiceType { - fn into(self) -> u32 { - match self { - Self::Monado => 0, - Self::Wivrn => 1, +impl From<&XRServiceType> for u32 { + fn from(value: &XRServiceType) -> Self { + match value { + XRServiceType::Monado => 0, + XRServiceType::Wivrn => 1, } } } @@ -215,12 +215,12 @@ impl From for LighthouseDriver { } } -impl Into for LighthouseDriver { - fn into(self) -> u32 { - match self { - Self::Vive => 0, - Self::Survive => 1, - Self::SteamVR => 2, +impl From<&LighthouseDriver> for u32 { + fn from(value: &LighthouseDriver) -> Self { + match value { + LighthouseDriver::Vive => 0, + LighthouseDriver::Survive => 1, + LighthouseDriver::SteamVR => 2, } } }