@@ -42,7 +42,7 @@ use rustls_pki_types::{CertificateDer, PrivateKeyDer, ServerName};
4242
4343use std:: {
4444 error:: Error ,
45- fmt:: { self , Debug } ,
45+ fmt,
4646 io:: { self , Read , Write } ,
4747 sync:: Arc ,
4848} ;
@@ -177,7 +177,7 @@ impl RustlsConnector {
177177 ///
178178 /// Returns a [`HandshakeError`] containing either the current state of the handshake or the
179179 /// failure when we couldn't complete the hanshake
180- pub fn connect < S : Debug + Read + Send + Sync + Write + ' static > (
180+ pub fn connect < S : Read + Write + Send + Sync + ' static > (
181181 & self ,
182182 domain : & str ,
183183 stream : S ,
@@ -196,9 +196,7 @@ impl RustlsConnector {
196196 /// # Errors
197197 ///
198198 /// Returns a [`io::Error`] containing the failure when we couldn't complete the TLS hanshake
199- pub async fn connect_async <
200- S : Debug + AsyncRead + AsyncWrite + Send + Sync + Unpin + ' static ,
201- > (
199+ pub async fn connect_async < S : AsyncRead + AsyncWrite + Send + Sync + Unpin + ' static > (
202200 & self ,
203201 domain : & str ,
204202 stream : S ,
@@ -227,7 +225,7 @@ pub struct MidHandshakeTlsStream<S: Read + Write> {
227225 stream : S ,
228226}
229227
230- impl < S : Debug + Read + Send + Sync + Write + ' static > MidHandshakeTlsStream < S > {
228+ impl < S : Read + Send + Sync + Write + ' static > MidHandshakeTlsStream < S > {
231229 /// Get a reference to the inner stream
232230 pub fn get_ref ( & self ) -> & S {
233231 & self . stream
@@ -265,16 +263,15 @@ impl<S: Read + Write> fmt::Display for MidHandshakeTlsStream<S> {
265263}
266264
267265/// An error returned while performing the handshake
268- #[ derive( Debug ) ]
269- pub enum HandshakeError < S : Read + Send + Sync + Write + ' static > {
266+ pub enum HandshakeError < S : Read + Write + Send + Sync + ' static > {
270267 /// We hit WouldBlock during handshake.
271268 /// Note that this is not a critical failure, you should be able to call handshake again once the stream is ready to perform I/O.
272269 WouldBlock ( Box < MidHandshakeTlsStream < S > > ) ,
273270 /// We hit a critical failure.
274271 Failure ( io:: Error ) ,
275272}
276273
277- impl < S : Debug + Read + Send + Sync + Write + ' static > fmt:: Display for HandshakeError < S > {
274+ impl < S : Read + Write + Send + Sync + ' static > fmt:: Display for HandshakeError < S > {
278275 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
279276 match self {
280277 HandshakeError :: WouldBlock ( _) => f. write_str ( "WouldBlock hit during handshake" ) ,
@@ -283,7 +280,18 @@ impl<S: Debug + Read + Send + Sync + Write + 'static> fmt::Display for Handshake
283280 }
284281}
285282
286- impl < S : Debug + Read + Send + Sync + Write + ' static > Error for HandshakeError < S > {
283+ impl < S : Read + Write + Send + Sync + ' static > fmt:: Debug for HandshakeError < S > {
284+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
285+ let mut d = f. debug_tuple ( "HandshakeError" ) ;
286+ match self {
287+ HandshakeError :: WouldBlock ( _) => d. field ( & "WouldBlock" ) ,
288+ HandshakeError :: Failure ( err) => d. field ( & err) ,
289+ }
290+ . finish ( )
291+ }
292+ }
293+
294+ impl < S : Read + Write + Send + Sync + ' static > Error for HandshakeError < S > {
287295 fn source ( & self ) -> Option < & ( dyn Error + ' static ) > {
288296 match self {
289297 HandshakeError :: Failure ( err) => Some ( err) ,
@@ -292,7 +300,7 @@ impl<S: Debug + Read + Send + Sync + Write + 'static> Error for HandshakeError<S
292300 }
293301}
294302
295- impl < S : Debug + Read + Send + Sync + Write + ' static > From < io:: Error > for HandshakeError < S > {
303+ impl < S : Read + Send + Sync + Write + ' static > From < io:: Error > for HandshakeError < S > {
296304 fn from ( err : io:: Error ) -> Self {
297305 HandshakeError :: Failure ( err)
298306 }
0 commit comments