From 830344d665c2aa2d7a3d08acbae39783339687d9 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Fri, 18 Jul 2025 06:55:50 +0200 Subject: [PATCH] chore: fix clippy --- src/build_tools/cmake.rs | 2 +- src/downloader.rs | 2 +- src/env_var_descriptions.rs | 2 +- src/gpu_profile.rs | 2 +- src/main.rs | 2 +- src/openxr_prober.rs | 2 +- src/profiles/lighthouse.rs | 2 +- src/profiles/openhmd.rs | 2 +- src/profiles/simulated.rs | 2 +- src/profiles/survive.rs | 2 +- src/profiles/wivrn.rs | 2 +- src/profiles/wmr.rs | 2 +- src/ui/app.rs | 2 +- src/ui/build_window.rs | 2 +- src/ui/preference_rows.rs | 4 ++-- src/ui/steam_launch_options_box.rs | 3 +-- src/ui/wivrn_wired_start_box.rs | 2 +- 17 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/build_tools/cmake.rs b/src/build_tools/cmake.rs index 5946ec6..ba9adbb 100644 --- a/src/build_tools/cmake.rs +++ b/src/build_tools/cmake.rs @@ -22,7 +22,7 @@ impl Cmake { if k.contains(' ') { panic!("Cmake vars cannot contain spaces!"); } - args.push(format!("-D{k}={v}", k = k, v = v)); + args.push(format!("-D{k}={v}")); } } args.push(self.source_dir.to_string_lossy().to_string()); diff --git a/src/downloader.rs b/src/downloader.rs index bb9a4b7..3b1b16b 100644 --- a/src/downloader.rs +++ b/src/downloader.rs @@ -13,7 +13,7 @@ const CHUNK_SIZE: usize = 1024; fn headers() -> HeaderMap { let mut headers = HeaderMap::new(); - headers.insert(USER_AGENT, format!("{}/1.0", APP_ID).parse().unwrap()); + headers.insert(USER_AGENT, format!("{APP_ID}/1.0").parse().unwrap()); headers } diff --git a/src/env_var_descriptions.rs b/src/env_var_descriptions.rs index ef92101..84a404b 100644 --- a/src/env_var_descriptions.rs +++ b/src/env_var_descriptions.rs @@ -65,7 +65,7 @@ fn env_var_descriptions() -> Vec<(&'static str, &'static str)> { fn env_var_descriptions_as_paragraph() -> String { ENV_VAR_DESCRIPTIONS .iter() - .map(|(k, v)| format!("{}\n{}", k, v)) + .map(|(k, v)| format!("{k}\n{v}")) .collect::>() .join("\n\n") } diff --git a/src/gpu_profile.rs b/src/gpu_profile.rs index 5a57c22..98eea11 100644 --- a/src/gpu_profile.rs +++ b/src/gpu_profile.rs @@ -116,7 +116,7 @@ fn list_gpus() -> Vec { for i in 0..5 { // arbitrary range, find a better way - let card_dir = PathBuf::from(format!("/sys/class/drm/card{}", i)); + let card_dir = PathBuf::from(format!("/sys/class/drm/card{i}")); let vendor_file = card_dir.join("device/vendor"); if let Some(mut reader) = get_reader(&vendor_file) { let mut buf = String::new(); diff --git a/src/main.rs b/src/main.rs index 217434e..553b034 100644 --- a/src/main.rs +++ b/src/main.rs @@ -157,7 +157,7 @@ fn main() -> Result<()> { } let provider = gtk::CssProvider::new(); - provider.load_from_resource(&format!("{}/style.css", RESOURCES_BASE_PATH)); + provider.load_from_resource(&format!("{RESOURCES_BASE_PATH}/style.css")); if let Some(display) = gdk::Display::default() { gtk::style_context_add_provider_for_display( &display, diff --git a/src/openxr_prober.rs b/src/openxr_prober.rs index c013959..de756e3 100644 --- a/src/openxr_prober.rs +++ b/src/openxr_prober.rs @@ -17,7 +17,7 @@ pub fn is_openxr_ready() -> bool { let Ok(xr_instance) = entry.create_instance( &xr::ApplicationInfo { - application_name: &format!("{}-openxr-prober", CMD_NAME), + application_name: &format!("{CMD_NAME}-openxr-prober"), application_version: 0, engine_name: CMD_NAME, engine_version: 0, diff --git a/src/profiles/lighthouse.rs b/src/profiles/lighthouse.rs index 97f3a1f..9ba0af8 100644 --- a/src/profiles/lighthouse.rs +++ b/src/profiles/lighthouse.rs @@ -21,7 +21,7 @@ pub fn lighthouse_profile() -> Profile { environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); Profile { uuid: "lighthouse-default".into(), - name: format!("Lighthouse Driver - {name} Default", name = APP_NAME), + name: format!("Lighthouse Driver - {APP_NAME} Default"), xrservice_path: data_monado_path(), xrservice_type: XRServiceType::Monado, ovr_comp: ProfileOvrCompatibilityModule { diff --git a/src/profiles/openhmd.rs b/src/profiles/openhmd.rs index 8709725..71ec6f7 100644 --- a/src/profiles/openhmd.rs +++ b/src/profiles/openhmd.rs @@ -21,7 +21,7 @@ pub fn openhmd_profile() -> Profile { environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); Profile { uuid: "openhmd-default".into(), - name: format!("OpenHMD - {name} Default", name = APP_NAME), + name: format!("OpenHMD - {APP_NAME} Default"), xrservice_path: data_monado_path(), xrservice_type: XRServiceType::Monado, ovr_comp: ProfileOvrCompatibilityModule { diff --git a/src/profiles/simulated.rs b/src/profiles/simulated.rs index a39a66b..c5af2ec 100644 --- a/src/profiles/simulated.rs +++ b/src/profiles/simulated.rs @@ -22,7 +22,7 @@ pub fn simulated_profile() -> Profile { ); Profile { uuid: "simulated-default".into(), - name: format!("Simulated Driver - {name} Default", name = APP_NAME), + name: format!("Simulated Driver - {APP_NAME} Default"), xrservice_path: data_monado_path(), xrservice_type: XRServiceType::Monado, ovr_comp: ProfileOvrCompatibilityModule { diff --git a/src/profiles/survive.rs b/src/profiles/survive.rs index d3e8ff6..6349b77 100644 --- a/src/profiles/survive.rs +++ b/src/profiles/survive.rs @@ -23,7 +23,7 @@ pub fn survive_profile() -> Profile { environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); Profile { uuid: "survive-default".into(), - name: format!("Survive - {name} Default", name = APP_NAME), + name: format!("Survive - {APP_NAME} Default"), xrservice_path: data_monado_path(), xrservice_type: XRServiceType::Monado, ovr_comp: ProfileOvrCompatibilityModule { diff --git a/src/profiles/wivrn.rs b/src/profiles/wivrn.rs index 980e1ed..b68e15d 100644 --- a/src/profiles/wivrn.rs +++ b/src/profiles/wivrn.rs @@ -19,7 +19,7 @@ pub fn wivrn_profile() -> Profile { environment.insert("U_PACING_APP_USE_MIN_FRAME_PERIOD".into(), "1".into()); Profile { uuid: "wivrn-default".into(), - name: format!("WiVRn - {name} Default", name = APP_NAME), + name: format!("WiVRn - {APP_NAME} Default"), xrservice_path: data_wivrn_path(), xrservice_type: XRServiceType::Wivrn, ovr_comp: ProfileOvrCompatibilityModule { diff --git a/src/profiles/wmr.rs b/src/profiles/wmr.rs index c332f6a..ae99d62 100644 --- a/src/profiles/wmr.rs +++ b/src/profiles/wmr.rs @@ -21,7 +21,7 @@ pub fn wmr_profile() -> Profile { environment.insert("LD_LIBRARY_PATH".into(), prepare_ld_library_path(&prefix)); Profile { uuid: "wmr-default".into(), - name: format!("WMR - {name} Default", name = APP_NAME), + name: format!("WMR - {APP_NAME} Default"), xrservice_path: data_monado_path(), xrservice_type: XRServiceType::Monado, ovr_comp: ProfileOvrCompatibilityModule { diff --git a/src/ui/app.rs b/src/ui/app.rs index 6201648..dc9d3b3 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -680,7 +680,7 @@ impl AsyncComponent for App { self.build_window .sender() .emit(BuildWindowMsg::UpdateBuildStatus(BuildStatus::Error( - format!("Exit status {}", errcode), + format!("Exit status {errcode}"), ))); } }; diff --git a/src/ui/build_window.rs b/src/ui/build_window.rs index f6f8b21..1bc966b 100644 --- a/src/ui/build_window.rs +++ b/src/ui/build_window.rs @@ -93,7 +93,7 @@ impl SimpleComponent for BuildWindow { BuildStatus::Building => String::default(), BuildStatus::Done => "Build done, you can close this window".into(), BuildStatus::Error(code) => { - format!("Build failed: \"{c}\"", c = code) + format!("Build failed: \"{code}\"") } }.as_str(), #[track = "model.changed(BuildWindow::build_status())"] diff --git a/src/ui/preference_rows.rs b/src/ui/preference_rows.rs index 4502ebf..bace44c 100644 --- a/src/ui/preference_rows.rs +++ b/src/ui/preference_rows.rs @@ -213,7 +213,7 @@ pub fn file_row) + 'static + Clone>( let filedialog = gtk::FileDialog::builder() .modal(true) - .title(format!("Select {}", title)) + .title(format!("Select {title}")) .build(); row.connect_activated(clone!( @@ -255,7 +255,7 @@ pub fn path_row) + 'static + Clone>( let (row, path_label) = filedialog_row_base(title, description, value, cb.clone()); let filedialog = gtk::FileDialog::builder() .modal(true) - .title(format!("Select Path for {}", title)) + .title(format!("Select Path for {title}")) .build(); row.connect_activated(clone!( diff --git a/src/ui/steam_launch_options_box.rs b/src/ui/steam_launch_options_box.rs index 6956bfe..28991b0 100644 --- a/src/ui/steam_launch_options_box.rs +++ b/src/ui/steam_launch_options_box.rs @@ -45,8 +45,7 @@ impl SimpleComponent for SteamLaunchOptionsBox { add_css_class: "dim-label", set_hexpand: true, set_label: format!( - "Set this string in the launch options of Steam games, so that they can pick up the {app} runtime correctly", - app = APP_NAME) + "Set this string in the launch options of Steam games, so that they can pick up the {APP_NAME} runtime correctly") .as_str(), set_xalign: 0.0, set_wrap: true, diff --git a/src/ui/wivrn_wired_start_box.rs b/src/ui/wivrn_wired_start_box.rs index 503bcac..b121c5f 100644 --- a/src/ui/wivrn_wired_start_box.rs +++ b/src/ui/wivrn_wired_start_box.rs @@ -112,7 +112,7 @@ impl AsyncComponent for WivrnWiredStartBox { Self::Input::UpdateSelectedProfile(p) => self.set_selected_profile(p), Self::Input::StartWivrnClient => { if !dep_adb().check() { - alert("ADB is not installed", Some(&format!("Please install ADB on your computer to start the WiVRn client from {}.", APP_NAME)), Some(&self.root_win)); + alert("ADB is not installed", Some(&format!("Please install ADB on your computer to start the WiVRn client from {APP_NAME}.")), Some(&self.root_win)); return; } self.set_start_client_status(StartClientStatus::InProgress);