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

@@ -80,7 +80,7 @@ impl LoginParam {
// Only check for IMAP password, SMTP password is an "advanced" setting.
ensure!(!param.imap.password.is_empty(), "Missing (IMAP) password.");
if param.smtp.password.is_empty() {
param.smtp.password = param.imap.password.clone()
param.smtp.password.clone_from(&param.imap.password)
}
Ok(param)
}