refactore: use clone_from() (#5451)

`a.clone_from(&b)` is equivalent to `a = b.clone()` in functionality,
but can be overridden to reuse the resources of a to avoid unnecessary
allocations.
This commit is contained in:
Sebastian Klähn
2024-04-10 15:01:11 +02:00
committed by GitHub
parent a3b62b9743
commit b47cad7e68
7 changed files with 14 additions and 14 deletions

View File

@@ -1527,7 +1527,7 @@ impl Chat {
Ok(contacts) => {
if let Some(contact_id) = contacts.first() {
if let Ok(contact) = Contact::get_by_id(context, *contact_id).await {
chat_name = contact.get_display_name().to_owned();
contact.get_display_name().clone_into(&mut chat_name);
}
}
}
@@ -2861,7 +2861,7 @@ pub(crate) async fn create_send_msg_jobs(context: &Context, msg: &mut Message) -
msg.update_param(context).await?;
}
msg.subject = rendered_msg.subject.clone();
msg.subject.clone_from(&rendered_msg.subject);
msg.update_subject(context).await?;
let chunk_size = context
.get_configured_provider()