mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-09-11 03:05:58 +03:00
Resolve uninlined_format_args clippy warnings
The upcomming release of Rust 1.67.0 will warn on `uninlined_format_args`. This PR resolves that by inlining all these items. It also looks nicer.
This commit is contained in:
committed by
Mathijs van Veluw
parent
988d24927e
commit
d30878c4ea
16
src/mail.rs
16
src/mail.rs
@@ -88,7 +88,7 @@ fn mailer() -> AsyncSmtpTransport<Tokio1Executor> {
|
||||
}
|
||||
|
||||
fn get_text(template_name: &'static str, data: serde_json::Value) -> Result<(String, String, String), Error> {
|
||||
let (subject_html, body_html) = get_template(&format!("{}.html", template_name), &data)?;
|
||||
let (subject_html, body_html) = get_template(&format!("{template_name}.html"), &data)?;
|
||||
let (_subject_text, body_text) = get_template(template_name, &data)?;
|
||||
Ok((subject_html, body_html, body_text))
|
||||
}
|
||||
@@ -531,27 +531,27 @@ async fn send_email(address: &str, subject: &str, body_html: String, body_text:
|
||||
Err(e) => {
|
||||
if e.is_client() {
|
||||
debug!("SMTP Client error: {:#?}", e);
|
||||
err!(format!("SMTP Client error: {}", e));
|
||||
err!(format!("SMTP Client error: {e}"));
|
||||
} else if e.is_transient() {
|
||||
debug!("SMTP 4xx error: {:#?}", e);
|
||||
err!(format!("SMTP 4xx error: {}", e));
|
||||
err!(format!("SMTP 4xx error: {e}"));
|
||||
} else if e.is_permanent() {
|
||||
debug!("SMTP 5xx error: {:#?}", e);
|
||||
let mut msg = e.to_string();
|
||||
// Add a special check for 535 to add a more descriptive message
|
||||
if msg.contains("(535)") {
|
||||
msg = format!("{} - Authentication credentials invalid", msg);
|
||||
msg = format!("{msg} - Authentication credentials invalid");
|
||||
}
|
||||
err!(format!("SMTP 5xx error: {}", msg));
|
||||
err!(format!("SMTP 5xx error: {msg}"));
|
||||
} else if e.is_timeout() {
|
||||
debug!("SMTP timeout error: {:#?}", e);
|
||||
err!(format!("SMTP timeout error: {}", e));
|
||||
err!(format!("SMTP timeout error: {e}"));
|
||||
} else if e.is_tls() {
|
||||
debug!("SMTP Encryption error: {:#?}", e);
|
||||
err!(format!("SMTP Encryption error: {}", e));
|
||||
err!(format!("SMTP Encryption error: {e}"));
|
||||
} else {
|
||||
debug!("SMTP {:#?}", e);
|
||||
err!(format!("SMTP {}", e));
|
||||
err!(format!("SMTP {e}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user