From 0884a0d76a24d2928a829c4971f309f2223b3a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sat, 11 May 2024 18:53:46 +0000 Subject: [PATCH] Fix assigning_clones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- core/src/session.rs | 14 +++++++------- core/src/spclient.rs | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/src/session.rs b/core/src/session.rs index 7801d68b..b8c55d20 100755 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -358,7 +358,7 @@ impl Session { loop { match reader.read_event_into(&mut buf) { Ok(Event::Start(ref element)) => { - current_element = std::str::from_utf8(element)?.to_owned() + std::str::from_utf8(element)?.clone_into(&mut current_element) } Ok(Event::End(_)) => { current_element = String::new(); @@ -428,7 +428,7 @@ impl Session { } pub fn set_client_id(&self, client_id: &str) { - self.0.data.write().client_id = client_id.to_owned(); + client_id.clone_into(&mut self.0.data.write().client_id); } pub fn client_name(&self) -> String { @@ -436,7 +436,7 @@ impl Session { } pub fn set_client_name(&self, client_name: &str) { - self.0.data.write().client_name = client_name.to_owned(); + client_name.clone_into(&mut self.0.data.write().client_name); } pub fn client_brand_name(&self) -> String { @@ -444,7 +444,7 @@ impl Session { } pub fn set_client_brand_name(&self, client_brand_name: &str) { - self.0.data.write().client_brand_name = client_brand_name.to_owned(); + client_brand_name.clone_into(&mut self.0.data.write().client_brand_name); } pub fn client_model_name(&self) -> String { @@ -452,7 +452,7 @@ impl Session { } pub fn set_client_model_name(&self, client_model_name: &str) { - self.0.data.write().client_model_name = client_model_name.to_owned(); + client_model_name.clone_into(&mut self.0.data.write().client_model_name); } pub fn connection_id(&self) -> String { @@ -460,7 +460,7 @@ impl Session { } pub fn set_connection_id(&self, connection_id: &str) { - self.0.data.write().connection_id = connection_id.to_owned(); + connection_id.clone_into(&mut self.0.data.write().connection_id); } pub fn username(&self) -> String { @@ -468,7 +468,7 @@ impl Session { } pub fn set_username(&self, username: &str) { - self.0.data.write().user_data.canonical_username = username.to_owned(); + username.clone_into(&mut self.0.data.write().user_data.canonical_username); } pub fn country(&self) -> String { diff --git a/core/src/spclient.rs b/core/src/spclient.rs index e5550d88..072cf40c 100644 --- a/core/src/spclient.rs +++ b/core/src/spclient.rs @@ -239,9 +239,9 @@ impl SpClient { let android_data = platform_data.mut_android(); android_data.android_version = os_version; android_data.api_version = 31; - android_data.device_name = "Pixel".to_owned(); - android_data.model_str = "GF5KQ".to_owned(); - android_data.vendor = "Google".to_owned(); + "Pixel".clone_into(&mut android_data.device_name); + "GF5KQ".clone_into(&mut android_data.model_str); + "Google".clone_into(&mut android_data.vendor); } "macos" => { let macos_data = platform_data.mut_desktop_macos();