resolve nightly performance assigning_clones lint

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-08 09:18:34 -05:00 committed by June
parent 4dfd5a7c15
commit aedb5966fe
5 changed files with 10 additions and 10 deletions

View file

@ -51,7 +51,7 @@ pub async fn update_device_route(body: Ruma<update_device::v3::Request>) -> Resu
.get_device_metadata(sender_user, &body.device_id)?
.ok_or(Error::BadRequest(ErrorKind::NotFound, "Device not found."))?;
device.display_name = body.display_name.clone();
device.display_name.clone_from(&body.display_name);
services().users.update_device_metadata(sender_user, &body.device_id, &device)?;

View file

@ -240,7 +240,7 @@ pub async fn kick_user_route(body: Ruma<kick_user::v3::Request>) -> Result<kick_
.map_err(|_| Error::bad_database("Invalid member event in database."))?;
event.membership = MembershipState::Leave;
event.reason = body.reason.clone();
event.reason.clone_from(&body.reason);
let mutex_state =
Arc::clone(services().globals.roomid_mutex_state.write().await.entry(body.room_id.clone()).or_default());
@ -347,7 +347,7 @@ pub async fn unban_user_route(body: Ruma<unban_user::v3::Request>) -> Result<unb
.map_err(|_| Error::bad_database("Invalid member event in database."))?;
event.membership = MembershipState::Leave;
event.reason = body.reason.clone();
event.reason.clone_from(&body.reason);
let mutex_state =
Arc::clone(services().globals.roomid_mutex_state.write().await.entry(body.room_id.clone()).or_default());

View file

@ -803,7 +803,7 @@ impl KeyValueDatabase {
let rule = rules_list.content.get(content_rule_transformation[0]);
if rule.is_some() {
let mut rule = rule.unwrap().clone();
rule.rule_id = content_rule_transformation[1].to_owned();
content_rule_transformation[1].clone_into(&mut rule.rule_id);
rules_list.content.shift_remove(content_rule_transformation[0]);
rules_list.content.insert(rule);
}
@ -823,7 +823,7 @@ impl KeyValueDatabase {
let rule = rules_list.underride.get(transformation[0]);
if let Some(rule) = rule {
let mut rule = rule.clone();
rule.rule_id = transformation[1].to_owned();
transformation[1].clone_into(&mut rule.rule_id);
rules_list.underride.shift_remove(transformation[0]);
rules_list.underride.insert(rule);
}

View file

@ -186,11 +186,11 @@ impl Service {
let mut device = Device::new(pusher.ids.app_id.clone(), pusher.ids.pushkey.clone());
device.data.default_payload = http.default_payload.clone();
device.data.format = http.format.clone();
device.data.format.clone_from(&http.format);
// Tweaks are only added if the format is NOT event_id_only
if !event_id_only {
device.tweaks = tweaks.clone();
device.tweaks.clone_from(&tweaks);
}
let d = vec![device];

View file

@ -69,10 +69,10 @@ impl Service {
for (list_id, list) in &mut request.lists {
if let Some(cached_list) = cached.lists.get(list_id) {
if list.sort.is_empty() {
list.sort = cached_list.sort.clone();
list.sort.clone_from(&cached_list.sort);
};
if list.room_details.required_state.is_empty() {
list.room_details.required_state = cached_list.room_details.required_state.clone();
list.room_details.required_state.clone_from(&cached_list.room_details.required_state);
};
list.room_details.timeline_limit =
list.room_details.timeline_limit.or(cached_list.room_details.timeline_limit);
@ -106,7 +106,7 @@ impl Service {
(..) => {},
}
if list.bump_event_types.is_empty() {
list.bump_event_types = cached_list.bump_event_types.clone();
list.bump_event_types.clone_from(&cached_list.bump_event_types);
};
}
cached.lists.insert(list_id.clone(), list.clone());