Skip to content

Commit e8b1fa9

Browse files
committed
Feature-gate proxy-related error types to avoid unused warnings
1 parent 3feab60 commit e8b1fa9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

bitreq/src/error.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,16 @@ pub enum Error {
5858
HttpsFeatureNotEnabled,
5959
/// The provided proxy information was not properly formatted. See
6060
/// [Proxy::new](crate::Proxy::new) for the valid format.
61+
#[cfg(feature = "proxy")]
6162
BadProxy,
6263
/// The provided credentials were rejected by the proxy server.
64+
#[cfg(feature = "proxy")]
6365
BadProxyCreds,
6466
/// The provided proxy credentials were malformed.
67+
#[cfg(feature = "proxy")]
6568
ProxyConnect,
6669
/// The provided credentials were rejected by the proxy server.
70+
#[cfg(feature = "proxy")]
6771
InvalidProxyCreds,
6872
/// The response body size surpasses
6973
/// [Request::with_max_body_size](crate::request::Request::with_max_body_size).
@@ -105,9 +109,13 @@ impl fmt::Display for Error {
105109
TooManyRedirections => write!(f, "too many redirections (over the max)"),
106110
InvalidUtf8InResponse => write!(f, "response contained invalid utf-8 where valid utf-8 was expected"),
107111
HttpsFeatureNotEnabled => write!(f, "request url contains https:// but the https feature is not enabled"),
112+
#[cfg(feature = "proxy")]
108113
BadProxy => write!(f, "the provided proxy information is malformed"),
114+
#[cfg(feature = "proxy")]
109115
BadProxyCreds => write!(f, "the provided proxy credentials are malformed"),
116+
#[cfg(feature = "proxy")]
110117
ProxyConnect => write!(f, "could not connect to the proxy server"),
118+
#[cfg(feature = "proxy")]
111119
InvalidProxyCreds => write!(f, "the provided proxy credentials are invalid"),
112120
BodyOverflow => write!(f, "the response body size surpassed max_body_size"),
113121
// TODO: Uncomment these two for 3.0

bitreq/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
//!
6060
//! ## `proxy`
6161
//!
62-
//! This feature enables HTTP proxy support. See [Proxy].
62+
//! This feature enables HTTP proxy support.
6363
//!
6464
//! # Examples
6565
//!

0 commit comments

Comments
 (0)