From 8e657c869240a337f6840c18ba7fc6e412c5858e Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Wed, 8 May 2024 19:19:37 +0200 Subject: [PATCH] refactor: fixed warnings --- src/i18n.rs | 4 ++-- src/ui/first_run/default_paths.rs | 19 ++++++++++--------- src/ui/preferences/enhancements/mod.rs | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/i18n.rs b/src/i18n.rs index 2d62374..ad00a35 100644 --- a/src/i18n.rs +++ b/src/i18n.rs @@ -106,7 +106,7 @@ macro_rules! tr { use fluent_templates::Loader; #[allow(unused_unsafe)] - $crate::i18n::LOCALES.lookup(unsafe { &$crate::i18n::LANG }, $id) + $crate::i18n::LOCALES.lookup(unsafe { $crate::i18n::LANG.as_ref() }, $id) } }; @@ -124,7 +124,7 @@ macro_rules! tr { )* #[allow(unused_unsafe)] - $crate::i18n::LOCALES.lookup_complete(unsafe { &$crate::i18n::LANG }, $id, Some(&args)) + $crate::i18n::LOCALES.lookup_complete(unsafe { $crate::i18n::LANG.as_ref() }, $id, Some(&args)) } }; } diff --git a/src/ui/first_run/default_paths.rs b/src/ui/first_run/default_paths.rs index 3967da2..76a5077 100644 --- a/src/ui/first_run/default_paths.rs +++ b/src/ui/first_run/default_paths.rs @@ -344,7 +344,8 @@ impl SimpleAsyncComponent for DefaultPathsApp { self.game_china = result.join(concat!("Yu", "anS", "hen")); self.fps_unlocker = result.join("fps-unlocker"); self.components = result.join("components"); - self.temp = result.clone(); + + self.temp.clone_from(&result); self.launcher = result; } @@ -435,15 +436,15 @@ impl DefaultPathsApp { pub fn update_config(&self) -> anyhow::Result<()> { let mut config = Config::get()?; - config.game.wine.builds = self.runners.clone(); - config.game.dxvk.builds = self.dxvks.clone(); - config.game.wine.prefix = self.prefix.clone(); - config.game.path.global = self.game_global.clone(); - config.game.path.china = self.game_china.clone(); - config.components.path = self.components.clone(); - config.launcher.temp = Some(self.temp.clone()); + config.game.wine.builds.clone_from(&self.runners); + config.game.dxvk.builds.clone_from(&self.dxvks); + config.game.wine.prefix.clone_from(&self.prefix); + config.game.path.global.clone_from(&self.game_global); + config.game.path.china.clone_from(&self.game_china); + config.components.path.clone_from(&self.components); + config.game.enhancements.fps_unlocker.path.clone_from(&self.fps_unlocker); - config.game.enhancements.fps_unlocker.path = self.fps_unlocker.clone(); + config.launcher.temp = Some(self.temp.clone()); Config::update_raw(config) } diff --git a/src/ui/preferences/enhancements/mod.rs b/src/ui/preferences/enhancements/mod.rs index 12b92ef..e38d149 100644 --- a/src/ui/preferences/enhancements/mod.rs +++ b/src/ui/preferences/enhancements/mod.rs @@ -754,7 +754,7 @@ impl SimpleAsyncComponent for EnhancementsApp { EnhancementsAppMsg::SetDiscordRpcIcon(index) => { if let Some(icon) = self.discord_rpc_icons.guard().get(index.current_index()) { if let Ok(mut config) = Config::get() { - config.launcher.discord_rpc.icon = icon.name.clone(); + config.launcher.discord_rpc.icon.clone_from(&icon.name); Config::update(config);