Repository: lettre/lettre (language: rust)

Issue:
Tokio1Executor and AsyncStd1Executor implement `std::fmt::Debug` suggest
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

in my case , 

```
#[derive(Debug, Clone)]
pub struct AppToolkit {
    pub config: Json,
    pub tpl: Template,
    pub db_pool: DatabaseDriver,
    pub mailer : AsyncSmtpTransport<Tokio1Executor>
}
```
when cargo run , errors:
```
error[E0277]: `AsyncSmtpTransport<Tokio1Executor>` doesn't implement `std::fmt::Debug`
   |
99 |     pub mailer : AsyncSmtpTransport<Tokio1Executor>
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `AsyncSmtpTransport<Tokio1Executor>` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
```

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

Tokio1Executor add `#[derive(Debug)]`  or add `#[allow(missing_debug_implementations)]`
```
#[allow(missing_copy_implementations)]
#[non_exhaustive]
#[cfg(feature = "tokio1")]
#[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))]
#[derive(Debug)]
pub struct Tokio1Executor;
```

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

```
rustc 1.50.0 (cb75ad5db 2021-02-10)
lettre = { version = "0.10.0-beta.2", features = ["smtp-transport", "tokio1-rustls-tls"], optional = true }
```



Discussion / hints:

Fix patch:
diff --git a/src/executor.rs b/src/executor.rs
index cdc004d9e..1a160199d 100644
--- a/src/executor.rs
+++ b/src/executor.rs
@@ -1,5 +1,6 @@
 use async_trait::async_trait;
 
+use std::fmt::Debug;
 #[cfg(feature = "file-transport")]
 use std::io::Result as IoResult;
 #[cfg(feature = "file-transport")]
@@ -39,7 +40,7 @@ use crate::transport::smtp::Error;
     doc(cfg(any(feature = "tokio02", feature = "tokio1", feature = "async-std1")))
 )]
 #[async_trait]
-pub trait Executor: Send + Sync + private::Sealed {
+pub trait Executor: Debug + Send + Sync + private::Sealed {
     #[doc(hidden)]
     #[cfg(feature = "smtp-transport")]
     async fn connect(
@@ -70,6 +71,7 @@ pub trait Executor: Send + Sync + private::Sealed {
 #[non_exhaustive]
 #[cfg(feature = "tokio02")]
 #[cfg_attr(docsrs, doc(cfg(feature = "tokio02")))]
+#[derive(Debug)]
 pub struct Tokio02Executor;
 
 #[async_trait]
@@ -135,6 +137,7 @@ impl Executor for Tokio02Executor {
 #[non_exhaustive]
 #[cfg(feature = "tokio1")]
 #[cfg_attr(docsrs, doc(cfg(feature = "tokio1")))]
+#[derive(Debug)]
 pub struct Tokio1Executor;
 
 #[async_trait]
@@ -199,6 +202,7 @@ impl Executor for Tokio1Executor {
 #[non_exhaustive]
 #[cfg(feature = "async-std1")]
 #[cfg_attr(docsrs, doc(cfg(feature = "async-std1")))]
+#[derive(Debug)]
 pub struct AsyncStd1Executor;
 
 #[async_trait]
diff --git a/src/transport/smtp/async_transport.rs b/src/transport/smtp/async_transport.rs
index b277078cf..8895661ef 100644
--- a/src/transport/smtp/async_transport.rs
+++ b/src/transport/smtp/async_transport.rs
@@ -1,3 +1,4 @@
+use std::fmt::{self, Debug};
 use std::marker::PhantomData;
 
 use async_trait::async_trait;
@@ -20,7 +21,6 @@ use crate::{Envelope, Executor};
     docsrs,
     doc(cfg(any(feature = "tokio02", feature = "tokio1", feature = "async-std1")))
 )]
-#[allow(missing_debug_implementations)]
 pub struct AsyncSmtpTransport<E> {
     // TODO: pool
     inner: AsyncSmtpClient<E>,
@@ -184,6 +184,14 @@ where
     }
 }
 
+impl<E> Debug for AsyncSmtpTransport<E> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let mut builder = f.debug_struct("AsyncSmtpTransport");
+        builder.field("inner", &self.inner);
+        builder.finish()
+    }
+}
+
 impl<E> Clone for AsyncSmtpTransport<E>
 where
     E: Executor,
@@ -197,8 +205,7 @@ where
 
 /// Contains client configuration.
 /// Instances of this struct can be created using functions of [`AsyncSmtpTransport`].
-#[allow(missing_debug_implementations)]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 #[cfg_attr(
     docsrs,
     doc(cfg(any(feature = "tokio02", feature = "tokio1", feature = "async-std1")))
@@ -271,9 +278,9 @@ impl AsyncSmtpTransportBuilder {
 }
 
 /// Build client
-pub struct AsyncSmtpClient<C> {
+pub struct AsyncSmtpClient<E> {
     info: SmtpInfo,
-    marker_: PhantomData<C>,
+    marker_: PhantomData<E>,
 }
 
 impl<E> AsyncSmtpClient<E>
@@ -299,6 +306,14 @@ where
     }
 }
 
+impl<E> Debug for AsyncSmtpClient<E> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let mut builder = f.debug_struct("AsyncSmtpClient");
+        builder.field("info", &self.info);
+        builder.finish()
+    }
+}
+
 impl<E> AsyncSmtpClient<E>
 where
     E: Executor,
diff --git a/src/transport/smtp/authentication.rs b/src/transport/smtp/authentication.rs
index 71d181cc4..36b766b37 100644
--- a/src/transport/smtp/authentication.rs
+++ b/src/transport/smtp/authentication.rs
@@ -1,14 +1,14 @@
 //! Provides limited SASL authentication mechanisms
 
 use crate::transport::smtp::error::{self, Error};
-use std::fmt::{self, Display, Formatter};
+use std::fmt::{self, Debug, Display, Formatter};
 
 /// Accepted authentication mechanisms
 /// Trying LOGIN last as it is deprecated.
 pub const DEFAULT_MECHANISMS: &[Mechanism] = &[Mechanism::Plain, Mechanism::Login];
 
 /// Contains user credentials
-#[derive(PartialEq, Eq, Clone, Hash, Debug)]
+#[derive(PartialEq, Eq, Clone, Hash)]
 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
 pub struct Credentials {
     authentication_identity: String,
@@ -35,6 +35,12 @@ where
     }
 }
 
+impl Debug for Credentials {
+    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+        f.debug_struct("Credentials").finish()
+    }
+}
+
 /// Represents authentication mechanisms
 #[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)]
 #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
diff --git a/src/transport/smtp/client/tls.rs b/src/transport/smtp/client/tls.rs
index 861efc4db..ed5d1e363 100644
--- a/src/transport/smtp/client/tls.rs
+++ b/src/transport/smtp/client/tls.rs
@@ -4,6 +4,7 @@ use crate::transport::smtp::{error, Error};
 use native_tls::{Protocol, TlsConnector};
 #[cfg(feature = "rustls-tls")]
 use rustls::{ClientConfig, RootCertStore, ServerCertVerified, ServerCertVerifier, TLSError};
+use std::fmt::{self, Debug};
 #[cfg(feature = "rustls-tls")]
 use std::sync::Arc;
 #[cfg(feature = "rustls-tls")]
@@ -32,9 +33,22 @@ pub enum Tls {
     Wrapper(TlsParameters),
 }
 
+impl Debug for Tls {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match &self {
+            Self::None => f.pad("None"),
+            #[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
+            Self::Opportunistic(_) => f.pad("Opportunistic"),
+            #[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
+            Self::Required(_) => f.pad("Required"),
+            #[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
+            Self::Wrapper(_) => f.pad("Wrapper"),
+        }
+    }
+}
+
 /// Parameters to use for secure clients
 #[derive(Clone)]
-#[allow(missing_debug_implementations)]
 pub struct TlsParameters {
     pub(crate) connector: InnerTlsParameters,
     /// The domain name which is expected in the TLS certificate from the server
@@ -42,7 +56,7 @@ pub struct TlsParameters {
 }
 
 /// Builder for `TlsParameters`
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub struct TlsParametersBuilder {
     domain: String,
     root_certs: Vec<Certificate>,
@@ -262,6 +276,12 @@ impl Certificate {
     }
 }
 
+impl Debug for Certificate {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_struct("Certificate").finish()
+    }
+}
+
 #[cfg(feature = "rustls-tls")]
 struct InvalidCertsVerifier;
 
diff --git a/src/transport/smtp/mod.rs b/src/transport/smtp/mod.rs
index 9e80eef5d..4bd932ef5 100644
--- a/src/transport/smtp/mod.rs
+++ b/src/transport/smtp/mod.rs
@@ -166,8 +166,7 @@ pub const SUBMISSIONS_PORT: u16 = 465;
 /// Default timeout
 pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(60);
 
-#[allow(missing_debug_implementations)]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 struct SmtpInfo {
     /// Name sent during EHLO
     hello_name: ClientId,
diff --git a/src/transport/smtp/transport.rs b/src/transport/smtp/transport.rs
index f3a672233..1055bff35 100644
--- a/src/transport/smtp/transport.rs
+++ b/src/transport/smtp/transport.rs
@@ -12,7 +12,6 @@ use crate::{address::Envelope, Transport};
 
 /// Sends emails using the SMTP protocol
 #[cfg_attr(docsrs, doc(cfg(feature = "smtp-transport")))]
-#[allow(missing_debug_implementations)]
 #[derive(Clone)]
 pub struct SmtpTransport {
     #[cfg(feature = "r2d2")]
@@ -112,8 +111,7 @@ impl SmtpTransport {
 
 /// Contains client configuration.
 /// Instances of this struct can be created using functions of [`SmtpTransport`].
-#[allow(missing_debug_implementations)]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub struct SmtpTransportBuilder {
     info: SmtpInfo,
     #[cfg(feature = "r2d2")]
@@ -185,7 +183,7 @@ impl SmtpTransportBuilder {
 }
 
 /// Build client
-#[derive(Clone)]
+#[derive(Debug, Clone)]
 pub struct SmtpClient {
     info: SmtpInfo,
 }


Test patch: