Replace to_string into_boxed_str with into

This commit is contained in:
Devin R 2020-07-17 19:52:04 -04:00
parent 59cbf202e4
commit 029c60be78
2 changed files with 5 additions and 5 deletions

View file

@ -220,7 +220,7 @@ pub fn register_route(
Ok(register::Response { Ok(register::Response {
access_token: Some(token), access_token: Some(token),
user_id, user_id,
device_id: Some(device_id.into_boxed_str()), device_id: Some(device_id.into()),
} }
.into()) .into())
} }
@ -268,7 +268,7 @@ pub fn login_route(
.body .body
.device_id .device_id
.clone() .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 // Generate a new token for the device
let token = utils::random_string(TOKEN_LENGTH); let token = utils::random_string(TOKEN_LENGTH);
@ -898,7 +898,7 @@ pub fn get_keys_route(
device_display_name: metadata.display_name, 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); device_keys.insert(user_id.clone(), container);
@ -917,7 +917,7 @@ pub fn get_keys_route(
device_display_name: metadata.display_name, 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); device_keys.insert(user_id.clone(), container);
} }

View file

@ -182,7 +182,7 @@ impl Users {
self.userdeviceid_metadata.insert( self.userdeviceid_metadata.insert(
userdeviceid, userdeviceid,
serde_json::to_string(&Device { 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, display_name: initial_device_display_name,
last_seen_ip: None, // TODO last_seen_ip: None, // TODO
last_seen_ts: Some(SystemTime::now()), last_seen_ts: Some(SystemTime::now()),