diff --git a/examples/asyncstd1_smtp_starttls.rs b/examples/asyncstd1_smtp_starttls.rs index 4bbbc68..1cb27d5 100644 --- a/examples/asyncstd1_smtp_starttls.rs +++ b/examples/asyncstd1_smtp_starttls.rs @@ -27,6 +27,6 @@ async fn main() { // Send the email match mailer.send(email).await { Ok(_) => println!("Email sent successfully!"), - Err(e) => panic!("Could not send email: {:?}", e), + Err(e) => panic!("Could not send email: {e:?}"), } } diff --git a/examples/asyncstd1_smtp_tls.rs b/examples/asyncstd1_smtp_tls.rs index 5612379..5605815 100644 --- a/examples/asyncstd1_smtp_tls.rs +++ b/examples/asyncstd1_smtp_tls.rs @@ -27,6 +27,6 @@ async fn main() { // Send the email match mailer.send(email).await { Ok(_) => println!("Email sent successfully!"), - Err(e) => panic!("Could not send email: {:?}", e), + Err(e) => panic!("Could not send email: {e:?}"), } } diff --git a/examples/smtp.rs b/examples/smtp.rs index 9314edb..4261faf 100644 --- a/examples/smtp.rs +++ b/examples/smtp.rs @@ -17,6 +17,6 @@ fn main() { // Send the email match mailer.send(&email) { Ok(_) => println!("Email sent successfully!"), - Err(e) => panic!("Could not send email: {:?}", e), + Err(e) => panic!("Could not send email: {e:?}"), } } diff --git a/examples/smtp_selfsigned.rs b/examples/smtp_selfsigned.rs index 873d304..afa3469 100644 --- a/examples/smtp_selfsigned.rs +++ b/examples/smtp_selfsigned.rs @@ -39,6 +39,6 @@ fn main() { // Send the email match mailer.send(&email) { Ok(_) => println!("Email sent successfully!"), - Err(e) => panic!("Could not send email: {:?}", e), + Err(e) => panic!("Could not send email: {e:?}"), } } diff --git a/examples/smtp_starttls.rs b/examples/smtp_starttls.rs index 5b83705..90d92e6 100644 --- a/examples/smtp_starttls.rs +++ b/examples/smtp_starttls.rs @@ -22,6 +22,6 @@ fn main() { // Send the email match mailer.send(&email) { Ok(_) => println!("Email sent successfully!"), - Err(e) => panic!("Could not send email: {:?}", e), + Err(e) => panic!("Could not send email: {e:?}"), } } diff --git a/examples/smtp_tls.rs b/examples/smtp_tls.rs index f77b5c2..f8daa2f 100644 --- a/examples/smtp_tls.rs +++ b/examples/smtp_tls.rs @@ -22,6 +22,6 @@ fn main() { // Send the email match mailer.send(&email) { Ok(_) => println!("Email sent successfully!"), - Err(e) => panic!("Could not send email: {:?}", e), + Err(e) => panic!("Could not send email: {e:?}"), } } diff --git a/examples/tokio1_smtp_starttls.rs b/examples/tokio1_smtp_starttls.rs index 19431d5..4fc51ae 100644 --- a/examples/tokio1_smtp_starttls.rs +++ b/examples/tokio1_smtp_starttls.rs @@ -31,6 +31,6 @@ async fn main() { // Send the email match mailer.send(email).await { Ok(_) => println!("Email sent successfully!"), - Err(e) => panic!("Could not send email: {:?}", e), + Err(e) => panic!("Could not send email: {e:?}"), } } diff --git a/examples/tokio1_smtp_tls.rs b/examples/tokio1_smtp_tls.rs index 5c86953..b45d947 100644 --- a/examples/tokio1_smtp_tls.rs +++ b/examples/tokio1_smtp_tls.rs @@ -31,6 +31,6 @@ async fn main() { // Send the email match mailer.send(email).await { Ok(_) => println!("Email sent successfully!"), - Err(e) => panic!("Could not send email: {:?}", e), + Err(e) => panic!("Could not send email: {e:?}"), } } diff --git a/src/address/types.rs b/src/address/types.rs index 4372daf..d5bb5f7 100644 --- a/src/address/types.rs +++ b/src/address/types.rs @@ -184,7 +184,7 @@ where let domain = domain.as_ref(); Address::check_domain(domain)?; - let serialized = format!("{}@{}", user, domain); + let serialized = format!("{user}@{domain}"); Ok(Address { serialized, at_start: user.len(), diff --git a/src/message/attachment.rs b/src/message/attachment.rs index f6d25a6..d91051d 100644 --- a/src/message/attachment.rs +++ b/src/message/attachment.rs @@ -96,7 +96,7 @@ impl Attachment { builder.header(header::ContentDisposition::attachment(&filename)) } Disposition::Inline(content_id) => builder - .header(header::ContentId::from(format!("<{}>", content_id))) + .header(header::ContentId::from(format!("<{content_id}>"))) .header(header::ContentDisposition::inline()), }; builder = builder.header(content_type); diff --git a/src/message/dkim.rs b/src/message/dkim.rs index 045d1ff..4532c09 100644 --- a/src/message/dkim.rs +++ b/src/message/dkim.rs @@ -588,7 +588,7 @@ cJ5Ku0OTwRtSMaseRPX+T4EfG1Caa/eunPPN4rh+CSup2BVVarOT ); let signed = message.formatted(); let signed = std::str::from_utf8(&signed).unwrap(); - println!("{}", signed); + println!("{signed}"); assert_eq!( signed, std::concat!( diff --git a/src/message/header/content_disposition.rs b/src/message/header/content_disposition.rs index 0eeabad..f901ea9 100644 --- a/src/message/header/content_disposition.rs +++ b/src/message/header/content_disposition.rs @@ -33,7 +33,7 @@ impl ContentDisposition { } fn with_name(kind: &str, file_name: &str) -> Self { - let raw_value = format!("{}; filename=\"{}\"", kind, file_name); + let raw_value = format!("{kind}; filename=\"{file_name}\""); let mut encoded_value = String::new(); let line_len = "Content-Disposition: ".len(); @@ -90,12 +90,12 @@ mod test { headers.set(ContentDisposition::inline()); - assert_eq!(format!("{}", headers), "Content-Disposition: inline\r\n"); + assert_eq!(format!("{headers}"), "Content-Disposition: inline\r\n"); headers.set(ContentDisposition::attachment("something.txt")); assert_eq!( - format!("{}", headers), + format!("{headers}"), "Content-Disposition: attachment; filename=\"something.txt\"\r\n" ); } diff --git a/src/message/header/content_type.rs b/src/message/header/content_type.rs index aac911f..ade52c3 100644 --- a/src/message/header/content_type.rs +++ b/src/message/header/content_type.rs @@ -135,8 +135,7 @@ mod serde { match ContentType::parse(mime) { Ok(content_type) => Ok(content_type), Err(_) => Err(E::custom(format!( - "Couldn't parse the following MIME-Type: {}", - mime + "Couldn't parse the following MIME-Type: {mime}" ))), } } diff --git a/src/message/mimebody.rs b/src/message/mimebody.rs index 5b7ca5f..51a202c 100644 --- a/src/message/mimebody.rs +++ b/src/message/mimebody.rs @@ -190,9 +190,9 @@ impl MultiPartKind { }, boundary, match self { - Self::Encrypted { protocol } => format!("; protocol=\"{}\"", protocol), + Self::Encrypted { protocol } => format!("; protocol=\"{protocol}\""), Self::Signed { protocol, micalg } => - format!("; protocol=\"{}\"; micalg=\"{}\"", protocol, micalg), + format!("; protocol=\"{protocol}\"; micalg=\"{micalg}\""), _ => String::new(), } ) diff --git a/src/transport/file/error.rs b/src/transport/file/error.rs index bbc6f0c..7a54306 100644 --- a/src/transport/file/error.rs +++ b/src/transport/file/error.rs @@ -71,7 +71,7 @@ impl fmt::Display for Error { }; if let Some(ref e) = self.inner.source { - write!(f, ": {}", e)?; + write!(f, ": {e}")?; } Ok(()) diff --git a/src/transport/file/mod.rs b/src/transport/file/mod.rs index 3e2fdbc..cdebf97 100644 --- a/src/transport/file/mod.rs +++ b/src/transport/file/mod.rs @@ -208,10 +208,10 @@ impl FileTransport { pub fn read(&self, email_id: &str) -> Result<(Envelope, Vec), Error> { use std::fs; - let eml_file = self.path.join(format!("{}.eml", email_id)); + let eml_file = self.path.join(format!("{email_id}.eml")); let eml = fs::read(eml_file).map_err(error::io)?; - let json_file = self.path.join(format!("{}.json", email_id)); + let json_file = self.path.join(format!("{email_id}.json")); let json = fs::read(json_file).map_err(error::io)?; let envelope = serde_json::from_slice(&json).map_err(error::envelope)?; @@ -219,7 +219,7 @@ impl FileTransport { } fn path(&self, email_id: &Uuid, extension: &str) -> PathBuf { - self.path.join(format!("{}.{}", email_id, extension)) + self.path.join(format!("{email_id}.{extension}")) } } @@ -255,10 +255,10 @@ where /// Reads the envelope and the raw message content. #[cfg(feature = "file-transport-envelope")] pub async fn read(&self, email_id: &str) -> Result<(Envelope, Vec), Error> { - let eml_file = self.inner.path.join(format!("{}.eml", email_id)); + let eml_file = self.inner.path.join(format!("{email_id}.eml")); let eml = E::fs_read(&eml_file).await.map_err(error::io)?; - let json_file = self.inner.path.join(format!("{}.json", email_id)); + let json_file = self.inner.path.join(format!("{email_id}.json")); let json = E::fs_read(&json_file).await.map_err(error::io)?; let envelope = serde_json::from_slice(&json).map_err(error::envelope)?; diff --git a/src/transport/sendmail/error.rs b/src/transport/sendmail/error.rs index ea613df..b1dad86 100644 --- a/src/transport/sendmail/error.rs +++ b/src/transport/sendmail/error.rs @@ -68,7 +68,7 @@ impl fmt::Display for Error { }; if let Some(ref e) = self.inner.source { - write!(f, ": {}", e)?; + write!(f, ": {e}")?; } Ok(()) diff --git a/src/transport/smtp/commands.rs b/src/transport/smtp/commands.rs index 24ac654..abea130 100644 --- a/src/transport/smtp/commands.rs +++ b/src/transport/smtp/commands.rs @@ -59,7 +59,7 @@ impl Display for Mail { self.sender.as_ref().map_or("", |s| s.as_ref()) )?; for parameter in &self.parameters { - write!(f, " {}", parameter)?; + write!(f, " {parameter}")?; } f.write_str("\r\n") } @@ -84,7 +84,7 @@ impl Display for Rcpt { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "RCPT TO:<{}>", self.recipient)?; for parameter in &self.parameters { - write!(f, " {}", parameter)?; + write!(f, " {parameter}")?; } f.write_str("\r\n") } @@ -144,7 +144,7 @@ impl Display for Help { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.write_str("HELP")?; if let Some(argument) = &self.argument { - write!(f, " {}", argument)?; + write!(f, " {argument}")?; } f.write_str("\r\n") } @@ -341,9 +341,9 @@ mod test { format!("{}", Rcpt::new(email, vec![rcpt_parameter])), "RCPT TO: TEST=value\r\n" ); - assert_eq!(format!("{}", Quit), "QUIT\r\n"); - assert_eq!(format!("{}", Data), "DATA\r\n"); - assert_eq!(format!("{}", Noop), "NOOP\r\n"); + assert_eq!(format!("{Quit}"), "QUIT\r\n"); + assert_eq!(format!("{Data}"), "DATA\r\n"); + assert_eq!(format!("{Noop}"), "NOOP\r\n"); assert_eq!(format!("{}", Help::new(None)), "HELP\r\n"); assert_eq!( format!("{}", Help::new(Some("test".to_string()))), @@ -357,7 +357,7 @@ mod test { format!("{}", Expn::new("test".to_string())), "EXPN test\r\n" ); - assert_eq!(format!("{}", Rset), "RSET\r\n"); + assert_eq!(format!("{Rset}"), "RSET\r\n"); let credentials = Credentials::new("user".to_string(), "password".to_string()); assert_eq!( format!( diff --git a/src/transport/smtp/error.rs b/src/transport/smtp/error.rs index a314870..e929238 100644 --- a/src/transport/smtp/error.rs +++ b/src/transport/smtp/error.rs @@ -137,15 +137,15 @@ impl fmt::Display for Error { #[cfg(any(feature = "native-tls", feature = "rustls-tls", feature = "boring-tls"))] Kind::Tls => f.write_str("tls error")?, Kind::Transient(ref code) => { - write!(f, "transient error ({})", code)?; + write!(f, "transient error ({code})")?; } Kind::Permanent(ref code) => { - write!(f, "permanent error ({})", code)?; + write!(f, "permanent error ({code})")?; } }; if let Some(ref e) = self.inner.source { - write!(f, ": {}", e)?; + write!(f, ": {e}")?; } Ok(()) diff --git a/src/transport/smtp/extension.rs b/src/transport/smtp/extension.rs index 8af14cf..370176c 100644 --- a/src/transport/smtp/extension.rs +++ b/src/transport/smtp/extension.rs @@ -55,8 +55,8 @@ impl Display for ClientId { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match *self { Self::Domain(ref value) => f.write_str(value), - Self::Ipv4(ref value) => write!(f, "[{}]", value), - Self::Ipv6(ref value) => write!(f, "[IPv6:{}]", value), + Self::Ipv4(ref value) => write!(f, "[{value}]"), + Self::Ipv6(ref value) => write!(f, "[IPv6:{value}]"), } } } @@ -97,7 +97,7 @@ impl Display for Extension { Extension::EightBitMime => f.write_str("8BITMIME"), Extension::SmtpUtfEight => f.write_str("SMTPUTF8"), Extension::StartTls => f.write_str("STARTTLS"), - Extension::Authentication(ref mechanism) => write!(f, "AUTH {}", mechanism), + Extension::Authentication(ref mechanism) => write!(f, "AUTH {mechanism}"), } } } @@ -228,8 +228,8 @@ pub enum MailParameter { impl Display for MailParameter { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match *self { - MailParameter::Body(ref value) => write!(f, "BODY={}", value), - MailParameter::Size(size) => write!(f, "SIZE={}", size), + MailParameter::Body(ref value) => write!(f, "BODY={value}"), + MailParameter::Size(size) => write!(f, "SIZE={size}"), MailParameter::SmtpUtfEight => f.write_str("SMTPUTF8"), MailParameter::Other { ref keyword, @@ -307,7 +307,7 @@ mod test { format!("{}", ClientId::Domain("test".to_string())), "test".to_string() ); - assert_eq!(format!("{}", LOCALHOST_CLIENT), "[127.0.0.1]".to_string()); + assert_eq!(format!("{LOCALHOST_CLIENT}"), "[127.0.0.1]".to_string()); } #[test] diff --git a/src/transport/smtp/response.rs b/src/transport/smtp/response.rs index 73ce167..4a9c93b 100644 --- a/src/transport/smtp/response.rs +++ b/src/transport/smtp/response.rs @@ -494,7 +494,7 @@ mod test { let res = parse_response(raw_response); match res { Err(nom::Err::Incomplete(_)) => {} - _ => panic!("Expected incomplete response, got {:?}", res), + _ => panic!("Expected incomplete response, got {res:?}"), } } diff --git a/tests/transport_file.rs b/tests/transport_file.rs index 70c5cf5..436c4b4 100644 --- a/tests/transport_file.rs +++ b/tests/transport_file.rs @@ -33,7 +33,7 @@ mod sync { let result = sender.send(&email); let id = result.unwrap(); - let eml_file = temp_dir().join(format!("{}.eml", id)); + let eml_file = temp_dir().join(format!("{id}.eml")); let eml = read_to_string(&eml_file).unwrap(); assert_eq!( @@ -68,10 +68,10 @@ mod sync { let result = sender.send(&email); let id = result.unwrap(); - let eml_file = temp_dir().join(format!("{}.eml", id)); + let eml_file = temp_dir().join(format!("{id}.eml")); let eml = read_to_string(&eml_file).unwrap(); - let json_file = temp_dir().join(format!("{}.json", id)); + let json_file = temp_dir().join(format!("{id}.json")); let json = read_to_string(&json_file).unwrap(); assert_eq!( @@ -131,7 +131,7 @@ mod tokio_1 { let result = sender.send(email).await; let id = result.unwrap(); - let eml_file = temp_dir().join(format!("{}.eml", id)); + let eml_file = temp_dir().join(format!("{id}.eml")); let eml = read_to_string(&eml_file).unwrap(); assert_eq!( @@ -182,7 +182,7 @@ mod asyncstd_1 { let result = sender.send(email).await; let id = result.unwrap(); - let eml_file = temp_dir().join(format!("{}.eml", id)); + let eml_file = temp_dir().join(format!("{id}.eml")); let eml = read_to_string(&eml_file).unwrap(); assert_eq!( diff --git a/tests/transport_sendmail.rs b/tests/transport_sendmail.rs index b17bafe..41c81ad 100644 --- a/tests/transport_sendmail.rs +++ b/tests/transport_sendmail.rs @@ -15,7 +15,7 @@ mod sync { .unwrap(); let result = sender.send(&email); - println!("{:?}", result); + println!("{result:?}"); assert!(result.is_ok()); } } @@ -42,7 +42,7 @@ mod tokio_1 { .unwrap(); let result = sender.send(email).await; - println!("{:?}", result); + println!("{result:?}"); assert!(result.is_ok()); } } @@ -68,7 +68,7 @@ mod asyncstd_1 { .unwrap(); let result = sender.send(email).await; - println!("{:?}", result); + println!("{result:?}"); assert!(result.is_ok()); } }