Skip to content

Commit 0884a0d

Browse files
committed
Fix assigning_clones
Signed-off-by: Christian König <[email protected]>
1 parent 5fc8d2d commit 0884a0d

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

core/src/session.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl Session {
358358
loop {
359359
match reader.read_event_into(&mut buf) {
360360
Ok(Event::Start(ref element)) => {
361-
current_element = std::str::from_utf8(element)?.to_owned()
361+
std::str::from_utf8(element)?.clone_into(&mut current_element)
362362
}
363363
Ok(Event::End(_)) => {
364364
current_element = String::new();
@@ -428,47 +428,47 @@ impl Session {
428428
}
429429

430430
pub fn set_client_id(&self, client_id: &str) {
431-
self.0.data.write().client_id = client_id.to_owned();
431+
client_id.clone_into(&mut self.0.data.write().client_id);
432432
}
433433

434434
pub fn client_name(&self) -> String {
435435
self.0.data.read().client_name.clone()
436436
}
437437

438438
pub fn set_client_name(&self, client_name: &str) {
439-
self.0.data.write().client_name = client_name.to_owned();
439+
client_name.clone_into(&mut self.0.data.write().client_name);
440440
}
441441

442442
pub fn client_brand_name(&self) -> String {
443443
self.0.data.read().client_brand_name.clone()
444444
}
445445

446446
pub fn set_client_brand_name(&self, client_brand_name: &str) {
447-
self.0.data.write().client_brand_name = client_brand_name.to_owned();
447+
client_brand_name.clone_into(&mut self.0.data.write().client_brand_name);
448448
}
449449

450450
pub fn client_model_name(&self) -> String {
451451
self.0.data.read().client_model_name.clone()
452452
}
453453

454454
pub fn set_client_model_name(&self, client_model_name: &str) {
455-
self.0.data.write().client_model_name = client_model_name.to_owned();
455+
client_model_name.clone_into(&mut self.0.data.write().client_model_name);
456456
}
457457

458458
pub fn connection_id(&self) -> String {
459459
self.0.data.read().connection_id.clone()
460460
}
461461

462462
pub fn set_connection_id(&self, connection_id: &str) {
463-
self.0.data.write().connection_id = connection_id.to_owned();
463+
connection_id.clone_into(&mut self.0.data.write().connection_id);
464464
}
465465

466466
pub fn username(&self) -> String {
467467
self.0.data.read().user_data.canonical_username.clone()
468468
}
469469

470470
pub fn set_username(&self, username: &str) {
471-
self.0.data.write().user_data.canonical_username = username.to_owned();
471+
username.clone_into(&mut self.0.data.write().user_data.canonical_username);
472472
}
473473

474474
pub fn country(&self) -> String {

core/src/spclient.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ impl SpClient {
239239
let android_data = platform_data.mut_android();
240240
android_data.android_version = os_version;
241241
android_data.api_version = 31;
242-
android_data.device_name = "Pixel".to_owned();
243-
android_data.model_str = "GF5KQ".to_owned();
244-
android_data.vendor = "Google".to_owned();
242+
"Pixel".clone_into(&mut android_data.device_name);
243+
"GF5KQ".clone_into(&mut android_data.model_str);
244+
"Google".clone_into(&mut android_data.vendor);
245245
}
246246
"macos" => {
247247
let macos_data = platform_data.mut_desktop_macos();

0 commit comments

Comments
 (0)