@@ -17,11 +17,12 @@ struct ErrorImpl {
17
17
cause : Option < Cause > ,
18
18
}
19
19
20
- #[ derive( Debug , PartialEq ) ]
20
+ #[ derive( Debug ) ]
21
21
pub ( super ) enum Kind {
22
22
Parse ( Parse ) ,
23
23
User ( User ) ,
24
24
/// A message reached EOF, but is not complete.
25
+ #[ allow( unused) ]
25
26
IncompleteMessage ,
26
27
/// A connection received a message (or bytes) when not waiting for one.
27
28
#[ cfg( feature = "http1" ) ]
@@ -34,6 +35,7 @@ pub(super) enum Kind {
34
35
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
35
36
Io ,
36
37
/// Error occurred while connecting.
38
+ #[ allow( unused) ]
37
39
Connect ,
38
40
/// Error creating a TcpListener.
39
41
#[ cfg( all(
@@ -63,7 +65,7 @@ pub(super) enum Kind {
63
65
Http2 ,
64
66
}
65
67
66
- #[ derive( Debug , PartialEq ) ]
68
+ #[ derive( Debug ) ]
67
69
pub ( super ) enum Parse {
68
70
Method ,
69
71
Version ,
@@ -77,7 +79,7 @@ pub(super) enum Parse {
77
79
Internal ,
78
80
}
79
81
80
- #[ derive( Debug , PartialEq ) ]
82
+ #[ derive( Debug ) ]
81
83
pub ( super ) enum User {
82
84
/// Error calling user's HttpBody::poll_data().
83
85
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
@@ -152,27 +154,27 @@ impl Error {
152
154
153
155
/// Returns true if this was about a `Request` that was canceled.
154
156
pub fn is_canceled ( & self ) -> bool {
155
- self . inner . kind == Kind :: Canceled
157
+ matches ! ( self . inner. kind, Kind :: Canceled )
156
158
}
157
159
158
160
/// Returns true if a sender's channel is closed.
159
161
pub fn is_closed ( & self ) -> bool {
160
- self . inner . kind == Kind :: ChannelClosed
162
+ matches ! ( self . inner. kind, Kind :: ChannelClosed )
161
163
}
162
164
163
165
/// Returns true if this was an error from `Connect`.
164
166
pub fn is_connect ( & self ) -> bool {
165
- self . inner . kind == Kind :: Connect
167
+ matches ! ( self . inner. kind, Kind :: Connect )
166
168
}
167
169
168
170
/// Returns true if the connection closed before a message could complete.
169
171
pub fn is_incomplete_message ( & self ) -> bool {
170
- self . inner . kind == Kind :: IncompleteMessage
172
+ matches ! ( self . inner. kind, Kind :: IncompleteMessage )
171
173
}
172
174
173
175
/// Returns true if the body write was aborted.
174
176
pub fn is_body_write_aborted ( & self ) -> bool {
175
- self . inner . kind == Kind :: BodyWriteAborted
177
+ matches ! ( self . inner. kind, Kind :: BodyWriteAborted )
176
178
}
177
179
178
180
/// Returns true if the error was caused by a timeout.
0 commit comments