Skip to content

Commit 07554de

Browse files
authored
refactor(error): remove lint config to allow unused code (#3486)
1 parent 15d9706 commit 07554de

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/error.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub(super) enum Kind {
4242
Parse(Parse),
4343
User(User),
4444
/// A message reached EOF, but is not complete.
45-
#[allow(unused)]
45+
#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
4646
IncompleteMessage,
4747
/// A connection received a message (or bytes) when not waiting for one.
4848
#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
@@ -100,7 +100,7 @@ pub(super) enum Parse {
100100
#[cfg(any(feature = "http1", feature = "http2"))]
101101
TooLarge,
102102
Status,
103-
#[cfg_attr(debug_assertions, allow(unused))]
103+
#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
104104
Internal,
105105
}
106106

@@ -215,6 +215,10 @@ impl Error {
215215

216216
/// Returns true if the connection closed before a message could complete.
217217
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"))]
218222
matches!(self.inner.kind, Kind::IncompleteMessage)
219223
}
220224

@@ -437,9 +441,11 @@ impl Error {
437441
#[cfg(any(feature = "http1", feature = "http2"))]
438442
Kind::Parse(Parse::TooLarge) => "message head is too large",
439443
Kind::Parse(Parse::Status) => "invalid HTTP status-code parsed",
444+
#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
440445
Kind::Parse(Parse::Internal) => {
441446
"internal error inside Hyper and/or its dependencies, please report"
442447
}
448+
#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
443449
Kind::IncompleteMessage => "connection closed before message completed",
444450
#[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))]
445451
Kind::UnexpectedMessage => "received unexpected message from connection",

0 commit comments

Comments
 (0)