@@ -17,11 +17,12 @@ struct ErrorImpl {
1717 cause : Option < Cause > ,
1818}
1919
20- #[ derive( Debug , PartialEq ) ]
20+ #[ derive( Debug ) ]
2121pub ( super ) enum Kind {
2222 Parse ( Parse ) ,
2323 User ( User ) ,
2424 /// A message reached EOF, but is not complete.
25+ #[ allow( unused) ]
2526 IncompleteMessage ,
2627 /// A connection received a message (or bytes) when not waiting for one.
2728 #[ cfg( feature = "http1" ) ]
@@ -34,6 +35,7 @@ pub(super) enum Kind {
3435 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
3536 Io ,
3637 /// Error occurred while connecting.
38+ #[ allow( unused) ]
3739 Connect ,
3840 /// Error creating a TcpListener.
3941 #[ cfg( all(
@@ -63,7 +65,7 @@ pub(super) enum Kind {
6365 Http2 ,
6466}
6567
66- #[ derive( Debug , PartialEq ) ]
68+ #[ derive( Debug ) ]
6769pub ( super ) enum Parse {
6870 Method ,
6971 Version ,
@@ -77,7 +79,7 @@ pub(super) enum Parse {
7779 Internal ,
7880}
7981
80- #[ derive( Debug , PartialEq ) ]
82+ #[ derive( Debug ) ]
8183pub ( super ) enum User {
8284 /// Error calling user's HttpBody::poll_data().
8385 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
@@ -152,27 +154,27 @@ impl Error {
152154
153155 /// Returns true if this was about a `Request` that was canceled.
154156 pub fn is_canceled ( & self ) -> bool {
155- self . inner . kind == Kind :: Canceled
157+ matches ! ( self . inner. kind, Kind :: Canceled )
156158 }
157159
158160 /// Returns true if a sender's channel is closed.
159161 pub fn is_closed ( & self ) -> bool {
160- self . inner . kind == Kind :: ChannelClosed
162+ matches ! ( self . inner. kind, Kind :: ChannelClosed )
161163 }
162164
163165 /// Returns true if this was an error from `Connect`.
164166 pub fn is_connect ( & self ) -> bool {
165- self . inner . kind == Kind :: Connect
167+ matches ! ( self . inner. kind, Kind :: Connect )
166168 }
167169
168170 /// Returns true if the connection closed before a message could complete.
169171 pub fn is_incomplete_message ( & self ) -> bool {
170- self . inner . kind == Kind :: IncompleteMessage
172+ matches ! ( self . inner. kind, Kind :: IncompleteMessage )
171173 }
172174
173175 /// Returns true if the body write was aborted.
174176 pub fn is_body_write_aborted ( & self ) -> bool {
175- self . inner . kind == Kind :: BodyWriteAborted
177+ matches ! ( self . inner. kind, Kind :: BodyWriteAborted )
176178 }
177179
178180 /// Returns true if the error was caused by a timeout.
0 commit comments