diff --git a/src/executor.rs b/src/executor.rs index 2bdbb50..62856af 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -134,7 +134,7 @@ impl Executor for Tokio1Executor { #[allow(clippy::match_single_binding)] let tls_parameters = match tls { #[cfg(any(feature = "tokio1-native-tls", feature = "tokio1-rustls-tls"))] - Tls::Wrapper(ref tls_parameters) => Some(tls_parameters.clone()), + Tls::Wrapper(tls_parameters) => Some(tls_parameters.clone()), _ => None, }; #[allow(unused_mut)] @@ -149,12 +149,12 @@ impl Executor for Tokio1Executor { #[cfg(any(feature = "tokio1-native-tls", feature = "tokio1-rustls-tls"))] match tls { - Tls::Opportunistic(ref tls_parameters) => { + Tls::Opportunistic(tls_parameters) => { if conn.can_starttls() { conn = conn.starttls(tls_parameters.clone(), hello_name).await?; } } - Tls::Required(ref tls_parameters) => { + Tls::Required(tls_parameters) => { conn = conn.starttls(tls_parameters.clone(), hello_name).await?; } _ => (), @@ -231,7 +231,7 @@ impl Executor for AsyncStd1Executor { #[allow(clippy::match_single_binding)] let tls_parameters = match tls { #[cfg(any(feature = "async-std1-native-tls", feature = "async-std1-rustls-tls"))] - Tls::Wrapper(ref tls_parameters) => Some(tls_parameters.clone()), + Tls::Wrapper(tls_parameters) => Some(tls_parameters.clone()), _ => None, }; #[allow(unused_mut)] @@ -245,12 +245,12 @@ impl Executor for AsyncStd1Executor { #[cfg(any(feature = "async-std1-native-tls", feature = "async-std1-rustls-tls"))] match tls { - Tls::Opportunistic(ref tls_parameters) => { + Tls::Opportunistic(tls_parameters) => { if conn.can_starttls() { conn = conn.starttls(tls_parameters.clone(), hello_name).await?; } } - Tls::Required(ref tls_parameters) => { + Tls::Required(tls_parameters) => { conn = conn.starttls(tls_parameters.clone(), hello_name).await?; } _ => (), diff --git a/src/message/mailbox/types.rs b/src/message/mailbox/types.rs index 7eacd80..bbf3b01 100644 --- a/src/message/mailbox/types.rs +++ b/src/message/mailbox/types.rs @@ -88,7 +88,7 @@ impl Mailbox { impl Display for Mailbox { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { - if let Some(ref name) = self.name { + if let Some(name) = &self.name { let name = name.trim(); if !name.is_empty() { write_word(f, name)?; diff --git a/src/transport/file/error.rs b/src/transport/file/error.rs index 7a54306..06e2bd5 100644 --- a/src/transport/file/error.rs +++ b/src/transport/file/error.rs @@ -54,7 +54,7 @@ impl fmt::Debug for Error { builder.field("kind", &self.inner.kind); - if let Some(ref source) = self.inner.source { + if let Some(source) = &self.inner.source { builder.field("source", source); } @@ -70,7 +70,7 @@ impl fmt::Display for Error { Kind::Envelope => f.write_str("internal client error")?, }; - if let Some(ref e) = self.inner.source { + if let Some(e) = &self.inner.source { write!(f, ": {e}")?; } diff --git a/src/transport/sendmail/error.rs b/src/transport/sendmail/error.rs index b1dad86..d812d85 100644 --- a/src/transport/sendmail/error.rs +++ b/src/transport/sendmail/error.rs @@ -52,7 +52,7 @@ impl fmt::Debug for Error { builder.field("kind", &self.inner.kind); - if let Some(ref source) = self.inner.source { + if let Some(source) = &self.inner.source { builder.field("source", source); } @@ -67,7 +67,7 @@ impl fmt::Display for Error { Kind::Client => f.write_str("internal client error")?, }; - if let Some(ref e) = self.inner.source { + if let Some(e) = &self.inner.source { write!(f, ": {e}")?; } diff --git a/src/transport/smtp/client/async_net.rs b/src/transport/smtp/client/async_net.rs index b0c3245..31eca13 100644 --- a/src/transport/smtp/client/async_net.rs +++ b/src/transport/smtp/client/async_net.rs @@ -99,23 +99,23 @@ impl AsyncNetworkStream { /// Returns peer's address pub fn peer_addr(&self) -> IoResult { - match self.inner { + match &self.inner { #[cfg(feature = "tokio1")] - InnerAsyncNetworkStream::Tokio1Tcp(ref s) => s.peer_addr(), + InnerAsyncNetworkStream::Tokio1Tcp(s) => s.peer_addr(), #[cfg(feature = "tokio1-native-tls")] - InnerAsyncNetworkStream::Tokio1NativeTls(ref s) => { + InnerAsyncNetworkStream::Tokio1NativeTls(s) => { s.get_ref().get_ref().get_ref().peer_addr() } #[cfg(feature = "tokio1-rustls-tls")] - InnerAsyncNetworkStream::Tokio1RustlsTls(ref s) => s.get_ref().0.peer_addr(), + InnerAsyncNetworkStream::Tokio1RustlsTls(s) => s.get_ref().0.peer_addr(), #[cfg(feature = "tokio1-boring-tls")] - InnerAsyncNetworkStream::Tokio1BoringTls(ref s) => s.get_ref().peer_addr(), + InnerAsyncNetworkStream::Tokio1BoringTls(s) => s.get_ref().peer_addr(), #[cfg(feature = "async-std1")] - InnerAsyncNetworkStream::AsyncStd1Tcp(ref s) => s.peer_addr(), + InnerAsyncNetworkStream::AsyncStd1Tcp(s) => s.peer_addr(), #[cfg(feature = "async-std1-native-tls")] - InnerAsyncNetworkStream::AsyncStd1NativeTls(ref s) => s.get_ref().peer_addr(), + InnerAsyncNetworkStream::AsyncStd1NativeTls(s) => s.get_ref().peer_addr(), #[cfg(feature = "async-std1-rustls-tls")] - InnerAsyncNetworkStream::AsyncStd1RustlsTls(ref s) => s.get_ref().0.peer_addr(), + InnerAsyncNetworkStream::AsyncStd1RustlsTls(s) => s.get_ref().0.peer_addr(), } } @@ -417,7 +417,7 @@ impl AsyncNetworkStream { } pub fn is_encrypted(&self) -> bool { - match self.inner { + match &self.inner { #[cfg(feature = "tokio1")] InnerAsyncNetworkStream::Tokio1Tcp(_) => false, #[cfg(feature = "tokio1-native-tls")] @@ -490,9 +490,9 @@ impl FuturesAsyncRead for AsyncNetworkStream { cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll> { - match self.inner { + match &mut self.inner { #[cfg(feature = "tokio1")] - InnerAsyncNetworkStream::Tokio1Tcp(ref mut s) => { + InnerAsyncNetworkStream::Tokio1Tcp(s) => { let mut b = Tokio1ReadBuf::new(buf); match Pin::new(s).poll_read(cx, &mut b) { Poll::Ready(Ok(())) => Poll::Ready(Ok(b.filled().len())), @@ -501,7 +501,7 @@ impl FuturesAsyncRead for AsyncNetworkStream { } } #[cfg(feature = "tokio1-native-tls")] - InnerAsyncNetworkStream::Tokio1NativeTls(ref mut s) => { + InnerAsyncNetworkStream::Tokio1NativeTls(s) => { let mut b = Tokio1ReadBuf::new(buf); match Pin::new(s).poll_read(cx, &mut b) { Poll::Ready(Ok(())) => Poll::Ready(Ok(b.filled().len())), @@ -510,7 +510,7 @@ impl FuturesAsyncRead for AsyncNetworkStream { } } #[cfg(feature = "tokio1-rustls-tls")] - InnerAsyncNetworkStream::Tokio1RustlsTls(ref mut s) => { + InnerAsyncNetworkStream::Tokio1RustlsTls(s) => { let mut b = Tokio1ReadBuf::new(buf); match Pin::new(s).poll_read(cx, &mut b) { Poll::Ready(Ok(())) => Poll::Ready(Ok(b.filled().len())), @@ -519,7 +519,7 @@ impl FuturesAsyncRead for AsyncNetworkStream { } } #[cfg(feature = "tokio1-boring-tls")] - InnerAsyncNetworkStream::Tokio1BoringTls(ref mut s) => { + InnerAsyncNetworkStream::Tokio1BoringTls(s) => { let mut b = Tokio1ReadBuf::new(buf); match Pin::new(s).poll_read(cx, &mut b) { Poll::Ready(Ok(())) => Poll::Ready(Ok(b.filled().len())), @@ -528,15 +528,11 @@ impl FuturesAsyncRead for AsyncNetworkStream { } } #[cfg(feature = "async-std1")] - InnerAsyncNetworkStream::AsyncStd1Tcp(ref mut s) => Pin::new(s).poll_read(cx, buf), + InnerAsyncNetworkStream::AsyncStd1Tcp(s) => Pin::new(s).poll_read(cx, buf), #[cfg(feature = "async-std1-native-tls")] - InnerAsyncNetworkStream::AsyncStd1NativeTls(ref mut s) => { - Pin::new(s).poll_read(cx, buf) - } + InnerAsyncNetworkStream::AsyncStd1NativeTls(s) => Pin::new(s).poll_read(cx, buf), #[cfg(feature = "async-std1-rustls-tls")] - InnerAsyncNetworkStream::AsyncStd1RustlsTls(ref mut s) => { - Pin::new(s).poll_read(cx, buf) - } + InnerAsyncNetworkStream::AsyncStd1RustlsTls(s) => Pin::new(s).poll_read(cx, buf), } } } @@ -547,63 +543,59 @@ impl FuturesAsyncWrite for AsyncNetworkStream { cx: &mut Context<'_>, buf: &[u8], ) -> Poll> { - match self.inner { + match &mut self.inner { #[cfg(feature = "tokio1")] - InnerAsyncNetworkStream::Tokio1Tcp(ref mut s) => Pin::new(s).poll_write(cx, buf), + InnerAsyncNetworkStream::Tokio1Tcp(s) => Pin::new(s).poll_write(cx, buf), #[cfg(feature = "tokio1-native-tls")] - InnerAsyncNetworkStream::Tokio1NativeTls(ref mut s) => Pin::new(s).poll_write(cx, buf), + InnerAsyncNetworkStream::Tokio1NativeTls(s) => Pin::new(s).poll_write(cx, buf), #[cfg(feature = "tokio1-rustls-tls")] - InnerAsyncNetworkStream::Tokio1RustlsTls(ref mut s) => Pin::new(s).poll_write(cx, buf), + InnerAsyncNetworkStream::Tokio1RustlsTls(s) => Pin::new(s).poll_write(cx, buf), #[cfg(feature = "tokio1-boring-tls")] - InnerAsyncNetworkStream::Tokio1BoringTls(ref mut s) => Pin::new(s).poll_write(cx, buf), + InnerAsyncNetworkStream::Tokio1BoringTls(s) => Pin::new(s).poll_write(cx, buf), #[cfg(feature = "async-std1")] - InnerAsyncNetworkStream::AsyncStd1Tcp(ref mut s) => Pin::new(s).poll_write(cx, buf), + InnerAsyncNetworkStream::AsyncStd1Tcp(s) => Pin::new(s).poll_write(cx, buf), #[cfg(feature = "async-std1-native-tls")] - InnerAsyncNetworkStream::AsyncStd1NativeTls(ref mut s) => { - Pin::new(s).poll_write(cx, buf) - } + InnerAsyncNetworkStream::AsyncStd1NativeTls(s) => Pin::new(s).poll_write(cx, buf), #[cfg(feature = "async-std1-rustls-tls")] - InnerAsyncNetworkStream::AsyncStd1RustlsTls(ref mut s) => { - Pin::new(s).poll_write(cx, buf) - } + InnerAsyncNetworkStream::AsyncStd1RustlsTls(s) => Pin::new(s).poll_write(cx, buf), } } fn poll_flush(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - match self.inner { + match &mut self.inner { #[cfg(feature = "tokio1")] - InnerAsyncNetworkStream::Tokio1Tcp(ref mut s) => Pin::new(s).poll_flush(cx), + InnerAsyncNetworkStream::Tokio1Tcp(s) => Pin::new(s).poll_flush(cx), #[cfg(feature = "tokio1-native-tls")] - InnerAsyncNetworkStream::Tokio1NativeTls(ref mut s) => Pin::new(s).poll_flush(cx), + InnerAsyncNetworkStream::Tokio1NativeTls(s) => Pin::new(s).poll_flush(cx), #[cfg(feature = "tokio1-rustls-tls")] - InnerAsyncNetworkStream::Tokio1RustlsTls(ref mut s) => Pin::new(s).poll_flush(cx), + InnerAsyncNetworkStream::Tokio1RustlsTls(s) => Pin::new(s).poll_flush(cx), #[cfg(feature = "tokio1-boring-tls")] - InnerAsyncNetworkStream::Tokio1BoringTls(ref mut s) => Pin::new(s).poll_flush(cx), + InnerAsyncNetworkStream::Tokio1BoringTls(s) => Pin::new(s).poll_flush(cx), #[cfg(feature = "async-std1")] - InnerAsyncNetworkStream::AsyncStd1Tcp(ref mut s) => Pin::new(s).poll_flush(cx), + InnerAsyncNetworkStream::AsyncStd1Tcp(s) => Pin::new(s).poll_flush(cx), #[cfg(feature = "async-std1-native-tls")] - InnerAsyncNetworkStream::AsyncStd1NativeTls(ref mut s) => Pin::new(s).poll_flush(cx), + InnerAsyncNetworkStream::AsyncStd1NativeTls(s) => Pin::new(s).poll_flush(cx), #[cfg(feature = "async-std1-rustls-tls")] - InnerAsyncNetworkStream::AsyncStd1RustlsTls(ref mut s) => Pin::new(s).poll_flush(cx), + InnerAsyncNetworkStream::AsyncStd1RustlsTls(s) => Pin::new(s).poll_flush(cx), } } fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - match self.inner { + match &mut self.inner { #[cfg(feature = "tokio1")] - InnerAsyncNetworkStream::Tokio1Tcp(ref mut s) => Pin::new(s).poll_shutdown(cx), + InnerAsyncNetworkStream::Tokio1Tcp(s) => Pin::new(s).poll_shutdown(cx), #[cfg(feature = "tokio1-native-tls")] - InnerAsyncNetworkStream::Tokio1NativeTls(ref mut s) => Pin::new(s).poll_shutdown(cx), + InnerAsyncNetworkStream::Tokio1NativeTls(s) => Pin::new(s).poll_shutdown(cx), #[cfg(feature = "tokio1-rustls-tls")] - InnerAsyncNetworkStream::Tokio1RustlsTls(ref mut s) => Pin::new(s).poll_shutdown(cx), + InnerAsyncNetworkStream::Tokio1RustlsTls(s) => Pin::new(s).poll_shutdown(cx), #[cfg(feature = "tokio1-boring-tls")] - InnerAsyncNetworkStream::Tokio1BoringTls(ref mut s) => Pin::new(s).poll_shutdown(cx), + InnerAsyncNetworkStream::Tokio1BoringTls(s) => Pin::new(s).poll_shutdown(cx), #[cfg(feature = "async-std1")] - InnerAsyncNetworkStream::AsyncStd1Tcp(ref mut s) => Pin::new(s).poll_close(cx), + InnerAsyncNetworkStream::AsyncStd1Tcp(s) => Pin::new(s).poll_close(cx), #[cfg(feature = "async-std1-native-tls")] - InnerAsyncNetworkStream::AsyncStd1NativeTls(ref mut s) => Pin::new(s).poll_close(cx), + InnerAsyncNetworkStream::AsyncStd1NativeTls(s) => Pin::new(s).poll_close(cx), #[cfg(feature = "async-std1-rustls-tls")] - InnerAsyncNetworkStream::AsyncStd1RustlsTls(ref mut s) => Pin::new(s).poll_close(cx), + InnerAsyncNetworkStream::AsyncStd1RustlsTls(s) => Pin::new(s).poll_close(cx), } } } diff --git a/src/transport/smtp/client/net.rs b/src/transport/smtp/client/net.rs index efede5d..e20b05b 100644 --- a/src/transport/smtp/client/net.rs +++ b/src/transport/smtp/client/net.rs @@ -48,27 +48,27 @@ impl NetworkStream { /// Returns peer's address pub fn peer_addr(&self) -> io::Result { - match self.inner { - InnerNetworkStream::Tcp(ref s) => s.peer_addr(), + match &self.inner { + InnerNetworkStream::Tcp(s) => s.peer_addr(), #[cfg(feature = "native-tls")] - InnerNetworkStream::NativeTls(ref s) => s.get_ref().peer_addr(), + InnerNetworkStream::NativeTls(s) => s.get_ref().peer_addr(), #[cfg(feature = "rustls-tls")] - InnerNetworkStream::RustlsTls(ref s) => s.get_ref().peer_addr(), + InnerNetworkStream::RustlsTls(s) => s.get_ref().peer_addr(), #[cfg(feature = "boring-tls")] - InnerNetworkStream::BoringTls(ref s) => s.get_ref().peer_addr(), + InnerNetworkStream::BoringTls(s) => s.get_ref().peer_addr(), } } /// Shutdowns the connection pub fn shutdown(&self, how: Shutdown) -> io::Result<()> { - match self.inner { - InnerNetworkStream::Tcp(ref s) => s.shutdown(how), + match &self.inner { + InnerNetworkStream::Tcp(s) => s.shutdown(how), #[cfg(feature = "native-tls")] - InnerNetworkStream::NativeTls(ref s) => s.get_ref().shutdown(how), + InnerNetworkStream::NativeTls(s) => s.get_ref().shutdown(how), #[cfg(feature = "rustls-tls")] - InnerNetworkStream::RustlsTls(ref s) => s.get_ref().shutdown(how), + InnerNetworkStream::RustlsTls(s) => s.get_ref().shutdown(how), #[cfg(feature = "boring-tls")] - InnerNetworkStream::BoringTls(ref s) => s.get_ref().shutdown(how), + InnerNetworkStream::BoringTls(s) => s.get_ref().shutdown(how), } } @@ -183,7 +183,7 @@ impl NetworkStream { } pub fn is_encrypted(&self) -> bool { - match self.inner { + match &self.inner { InnerNetworkStream::Tcp(_) => false, #[cfg(feature = "native-tls")] InnerNetworkStream::NativeTls(_) => true, @@ -224,80 +224,68 @@ impl NetworkStream { } pub fn set_read_timeout(&mut self, duration: Option) -> io::Result<()> { - match self.inner { - InnerNetworkStream::Tcp(ref mut stream) => stream.set_read_timeout(duration), + match &mut self.inner { + InnerNetworkStream::Tcp(stream) => stream.set_read_timeout(duration), #[cfg(feature = "native-tls")] - InnerNetworkStream::NativeTls(ref mut stream) => { - stream.get_ref().set_read_timeout(duration) - } + InnerNetworkStream::NativeTls(stream) => stream.get_ref().set_read_timeout(duration), #[cfg(feature = "rustls-tls")] - InnerNetworkStream::RustlsTls(ref mut stream) => { - stream.get_ref().set_read_timeout(duration) - } + InnerNetworkStream::RustlsTls(stream) => stream.get_ref().set_read_timeout(duration), #[cfg(feature = "boring-tls")] - InnerNetworkStream::BoringTls(ref mut stream) => { - stream.get_ref().set_read_timeout(duration) - } + InnerNetworkStream::BoringTls(stream) => stream.get_ref().set_read_timeout(duration), } } /// Set write timeout for IO calls pub fn set_write_timeout(&mut self, duration: Option) -> io::Result<()> { - match self.inner { - InnerNetworkStream::Tcp(ref mut stream) => stream.set_write_timeout(duration), + match &mut self.inner { + InnerNetworkStream::Tcp(stream) => stream.set_write_timeout(duration), #[cfg(feature = "native-tls")] - InnerNetworkStream::NativeTls(ref mut stream) => { - stream.get_ref().set_write_timeout(duration) - } + InnerNetworkStream::NativeTls(stream) => stream.get_ref().set_write_timeout(duration), #[cfg(feature = "rustls-tls")] - InnerNetworkStream::RustlsTls(ref mut stream) => { - stream.get_ref().set_write_timeout(duration) - } + InnerNetworkStream::RustlsTls(stream) => stream.get_ref().set_write_timeout(duration), #[cfg(feature = "boring-tls")] - InnerNetworkStream::BoringTls(ref mut stream) => { - stream.get_ref().set_write_timeout(duration) - } + InnerNetworkStream::BoringTls(stream) => stream.get_ref().set_write_timeout(duration), } } } impl Read for NetworkStream { fn read(&mut self, buf: &mut [u8]) -> io::Result { - match self.inner { - InnerNetworkStream::Tcp(ref mut s) => s.read(buf), + match &mut self.inner { + InnerNetworkStream::Tcp(s) => s.read(buf), #[cfg(feature = "native-tls")] - InnerNetworkStream::NativeTls(ref mut s) => s.read(buf), + InnerNetworkStream::NativeTls(s) => s.read(buf), #[cfg(feature = "rustls-tls")] - InnerNetworkStream::RustlsTls(ref mut s) => s.read(buf), + InnerNetworkStream::RustlsTls(s) => s.read(buf), #[cfg(feature = "boring-tls")] - InnerNetworkStream::BoringTls(ref mut s) => s.read(buf), + InnerNetworkStream::BoringTls(s) => s.read(buf), } } } impl Write for NetworkStream { fn write(&mut self, buf: &[u8]) -> io::Result { - match self.inner { - InnerNetworkStream::Tcp(ref mut s) => s.write(buf), + match &mut self.inner { + InnerNetworkStream::Tcp(s) => s.write(buf), #[cfg(feature = "native-tls")] - InnerNetworkStream::NativeTls(ref mut s) => s.write(buf), + InnerNetworkStream::NativeTls(s) => s.write(buf), #[cfg(feature = "rustls-tls")] - InnerNetworkStream::RustlsTls(ref mut s) => s.write(buf), + InnerNetworkStream::RustlsTls(s) => s.write(buf), #[cfg(feature = "boring-tls")] - InnerNetworkStream::BoringTls(ref mut s) => s.write(buf), + InnerNetworkStream::BoringTls(s) => s.write(buf), } } fn flush(&mut self) -> io::Result<()> { - match self.inner { - InnerNetworkStream::Tcp(ref mut s) => s.flush(), + match &mut self.inner { + InnerNetworkStream::Tcp(s) => s.flush(), #[cfg(feature = "native-tls")] - InnerNetworkStream::NativeTls(ref mut s) => s.flush(), + InnerNetworkStream::NativeTls(s) => s.flush(), #[cfg(feature = "rustls-tls")] - InnerNetworkStream::RustlsTls(ref mut s) => s.flush(), + InnerNetworkStream::RustlsTls(s) => s.flush(), #[cfg(feature = "boring-tls")] - InnerNetworkStream::BoringTls(ref mut s) => s.flush(), + InnerNetworkStream::BoringTls(s) => s.flush(), } } } diff --git a/src/transport/smtp/error.rs b/src/transport/smtp/error.rs index e929238..49fa254 100644 --- a/src/transport/smtp/error.rs +++ b/src/transport/smtp/error.rs @@ -119,7 +119,7 @@ impl fmt::Debug for Error { builder.field("kind", &self.inner.kind); - if let Some(ref source) = self.inner.source { + if let Some(source) = &self.inner.source { builder.field("source", source); } @@ -129,22 +129,22 @@ impl fmt::Debug for Error { impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self.inner.kind { + match &self.inner.kind { Kind::Response => f.write_str("response error")?, Kind::Client => f.write_str("internal client error")?, Kind::Network => f.write_str("network error")?, Kind::Connection => f.write_str("Connection error")?, #[cfg(any(feature = "native-tls", feature = "rustls-tls", feature = "boring-tls"))] Kind::Tls => f.write_str("tls error")?, - Kind::Transient(ref code) => { + Kind::Transient(code) => { write!(f, "transient error ({code})")?; } - Kind::Permanent(ref code) => { + Kind::Permanent(code) => { write!(f, "permanent error ({code})")?; } }; - if let Some(ref e) = self.inner.source { + if let Some(e) = &self.inner.source { write!(f, ": {e}")?; } diff --git a/src/transport/smtp/extension.rs b/src/transport/smtp/extension.rs index afdadf5..dd294c5 100644 --- a/src/transport/smtp/extension.rs +++ b/src/transport/smtp/extension.rs @@ -52,10 +52,10 @@ impl Default for ClientId { 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}]"), + match self { + Self::Domain(value) => f.write_str(value), + Self::Ipv4(value) => write!(f, "[{value}]"), + Self::Ipv6(value) => write!(f, "[IPv6:{value}]"), } } } @@ -92,11 +92,11 @@ pub enum Extension { impl Display for Extension { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - match *self { + match self { 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(mechanism) => write!(f, "AUTH {mechanism}"), } } } @@ -226,16 +226,16 @@ 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}"), + match self { + MailParameter::Body(value) => write!(f, "BODY={value}"), MailParameter::Size(size) => write!(f, "SIZE={size}"), MailParameter::SmtpUtfEight => f.write_str("SMTPUTF8"), MailParameter::Other { - ref keyword, - value: Some(ref value), + keyword, + value: Some(value), } => write!(f, "{}={}", keyword, XText(value)), MailParameter::Other { - ref keyword, + keyword, value: None, } => f.write_str(keyword), } @@ -276,13 +276,13 @@ pub enum RcptParameter { impl Display for RcptParameter { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - match *self { + match &self { RcptParameter::Other { - ref keyword, - value: Some(ref value), + keyword, + value: Some(value), } => write!(f, "{keyword}={}", XText(value)), RcptParameter::Other { - ref keyword, + keyword, value: None, } => f.write_str(keyword), } diff --git a/src/transport/smtp/transport.rs b/src/transport/smtp/transport.rs index 4baa99c..d93ec3c 100644 --- a/src/transport/smtp/transport.rs +++ b/src/transport/smtp/transport.rs @@ -317,9 +317,9 @@ impl SmtpClient { /// Handles encryption and authentication pub fn connection(&self) -> Result { #[allow(clippy::match_single_binding)] - let tls_parameters = match self.info.tls { + let tls_parameters = match &self.info.tls { #[cfg(any(feature = "native-tls", feature = "rustls-tls", feature = "boring-tls"))] - Tls::Wrapper(ref tls_parameters) => Some(tls_parameters), + Tls::Wrapper(tls_parameters) => Some(tls_parameters), _ => None, }; @@ -333,13 +333,13 @@ impl SmtpClient { )?; #[cfg(any(feature = "native-tls", feature = "rustls-tls", feature = "boring-tls"))] - match self.info.tls { - Tls::Opportunistic(ref tls_parameters) => { + match &self.info.tls { + Tls::Opportunistic(tls_parameters) => { if conn.can_starttls() { conn = conn.starttls(tls_parameters, &self.info.hello_name)?; } } - Tls::Required(ref tls_parameters) => { + Tls::Required(tls_parameters) => { conn = conn.starttls(tls_parameters, &self.info.hello_name)?; } _ => (),