@@ -42,7 +42,7 @@ pub(super) enum Kind {
42
42
Parse ( Parse ) ,
43
43
User ( User ) ,
44
44
/// A message reached EOF, but is not complete.
45
- #[ allow ( unused ) ]
45
+ #[ cfg ( all ( any ( feature = "client" , feature = "server" ) , feature = "http1" ) ) ]
46
46
IncompleteMessage ,
47
47
/// A connection received a message (or bytes) when not waiting for one.
48
48
#[ cfg( all( any( feature = "client" , feature = "server" ) , feature = "http1" ) ) ]
@@ -100,7 +100,7 @@ pub(super) enum Parse {
100
100
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
101
101
TooLarge ,
102
102
Status ,
103
- #[ cfg_attr ( debug_assertions , allow ( unused ) ) ]
103
+ #[ cfg ( all ( any ( feature = "client" , feature = "server" ) , feature = "http1" ) ) ]
104
104
Internal ,
105
105
}
106
106
@@ -215,6 +215,10 @@ impl Error {
215
215
216
216
/// Returns true if the connection closed before a message could complete.
217
217
pub fn is_incomplete_message ( & self ) -> bool {
218
+ #[ cfg( not( all( any( feature = "client" , feature = "server" ) , feature = "http1" ) ) ) ]
219
+ return false ;
220
+
221
+ #[ cfg( all( any( feature = "client" , feature = "server" ) , feature = "http1" ) ) ]
218
222
matches ! ( self . inner. kind, Kind :: IncompleteMessage )
219
223
}
220
224
@@ -437,9 +441,11 @@ impl Error {
437
441
#[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
438
442
Kind :: Parse ( Parse :: TooLarge ) => "message head is too large" ,
439
443
Kind :: Parse ( Parse :: Status ) => "invalid HTTP status-code parsed" ,
444
+ #[ cfg( all( any( feature = "client" , feature = "server" ) , feature = "http1" ) ) ]
440
445
Kind :: Parse ( Parse :: Internal ) => {
441
446
"internal error inside Hyper and/or its dependencies, please report"
442
447
}
448
+ #[ cfg( all( any( feature = "client" , feature = "server" ) , feature = "http1" ) ) ]
443
449
Kind :: IncompleteMessage => "connection closed before message completed" ,
444
450
#[ cfg( all( any( feature = "client" , feature = "server" ) , feature = "http1" ) ) ]
445
451
Kind :: UnexpectedMessage => "received unexpected message from connection" ,
0 commit comments