From 029c60be783519249aeba845fd5ceff10b239d43 Mon Sep 17 00:00:00 2001 From: Devin R Date: Fri, 17 Jul 2020 19:52:04 -0400 Subject: [PATCH] Replace to_string into_boxed_str with into --- src/client_server.rs | 8 ++++---- src/database/users.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client_server.rs b/src/client_server.rs index efe6973..1300bff 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -220,7 +220,7 @@ pub fn register_route( Ok(register::Response { access_token: Some(token), user_id, - device_id: Some(device_id.into_boxed_str()), + device_id: Some(device_id.into()), } .into()) } @@ -268,7 +268,7 @@ pub fn login_route( .body .device_id .clone() - .unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH).into_boxed_str()); + .unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH).into()); // Generate a new token for the device let token = utils::random_string(TOKEN_LENGTH); @@ -898,7 +898,7 @@ pub fn get_keys_route( device_display_name: metadata.display_name, }); - container.insert(device_id.to_owned().into_boxed_str(), keys); + container.insert(device_id.into(), keys); } } device_keys.insert(user_id.clone(), container); @@ -917,7 +917,7 @@ pub fn get_keys_route( device_display_name: metadata.display_name, }); - container.insert(device_id.to_string().into_boxed_str(), keys); + container.insert(device_id.as_ref().into(), keys); } device_keys.insert(user_id.clone(), container); } diff --git a/src/database/users.rs b/src/database/users.rs index b755b18..b103691 100644 --- a/src/database/users.rs +++ b/src/database/users.rs @@ -182,7 +182,7 @@ impl Users { self.userdeviceid_metadata.insert( userdeviceid, serde_json::to_string(&Device { - device_id: device_id.to_string().into_boxed_str(), + device_id: device_id.into(), display_name: initial_device_display_name, last_seen_ip: None, // TODO last_seen_ts: Some(SystemTime::now()),