Remove unnecessary Result returns.
This commit is contained in:
@@ -221,7 +221,7 @@ impl ClientBuilder {
|
|||||||
proxies.clone(),
|
proxies.clone(),
|
||||||
user_agent(&config.headers),
|
user_agent(&config.headers),
|
||||||
config.local_address,
|
config.local_address,
|
||||||
config.nodelay)?
|
config.nodelay)
|
||||||
},
|
},
|
||||||
#[cfg(feature = "rustls-tls")]
|
#[cfg(feature = "rustls-tls")]
|
||||||
TlsBackend::BuiltRustls(conn) => {
|
TlsBackend::BuiltRustls(conn) => {
|
||||||
@@ -231,7 +231,7 @@ impl ClientBuilder {
|
|||||||
proxies.clone(),
|
proxies.clone(),
|
||||||
user_agent(&config.headers),
|
user_agent(&config.headers),
|
||||||
config.local_address,
|
config.local_address,
|
||||||
config.nodelay)?
|
config.nodelay)
|
||||||
},
|
},
|
||||||
#[cfg(feature = "rustls-tls")]
|
#[cfg(feature = "rustls-tls")]
|
||||||
TlsBackend::Rustls => {
|
TlsBackend::Rustls => {
|
||||||
@@ -266,7 +266,7 @@ impl ClientBuilder {
|
|||||||
user_agent(&config.headers),
|
user_agent(&config.headers),
|
||||||
config.local_address,
|
config.local_address,
|
||||||
config.nodelay,
|
config.nodelay,
|
||||||
)?
|
)
|
||||||
},
|
},
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "native-tls",
|
feature = "native-tls",
|
||||||
@@ -280,7 +280,7 @@ impl ClientBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "__tls"))]
|
#[cfg(not(feature = "__tls"))]
|
||||||
Connector::new(http, proxies.clone(), config.local_address, config.nodelay)?
|
Connector::new(http, proxies.clone(), config.local_address, config.nodelay)
|
||||||
};
|
};
|
||||||
|
|
||||||
connector.set_timeout(config.connect_timeout);
|
connector.set_timeout(config.connect_timeout);
|
||||||
|
|||||||
@@ -137,18 +137,18 @@ impl Connector {
|
|||||||
proxies: Arc<Vec<Proxy>>,
|
proxies: Arc<Vec<Proxy>>,
|
||||||
local_addr: T,
|
local_addr: T,
|
||||||
nodelay: bool,
|
nodelay: bool,
|
||||||
) -> crate::Result<Connector>
|
) -> Connector
|
||||||
where
|
where
|
||||||
T: Into<Option<IpAddr>>,
|
T: Into<Option<IpAddr>>,
|
||||||
{
|
{
|
||||||
http.set_local_address(local_addr.into());
|
http.set_local_address(local_addr.into());
|
||||||
http.set_nodelay(nodelay);
|
http.set_nodelay(nodelay);
|
||||||
Ok(Connector {
|
Connector {
|
||||||
inner: Inner::Http(http),
|
inner: Inner::Http(http),
|
||||||
verbose: verbose::OFF,
|
verbose: verbose::OFF,
|
||||||
proxies,
|
proxies,
|
||||||
timeout: None,
|
timeout: None,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "default-tls")]
|
#[cfg(feature = "default-tls")]
|
||||||
@@ -164,14 +164,14 @@ impl Connector {
|
|||||||
T: Into<Option<IpAddr>>,
|
T: Into<Option<IpAddr>>,
|
||||||
{
|
{
|
||||||
let tls = tls.build().map_err(crate::error::builder)?;
|
let tls = tls.build().map_err(crate::error::builder)?;
|
||||||
Self::from_built_default_tls(
|
Ok(Self::from_built_default_tls(
|
||||||
http,
|
http,
|
||||||
tls,
|
tls,
|
||||||
proxies,
|
proxies,
|
||||||
user_agent,
|
user_agent,
|
||||||
local_addr,
|
local_addr,
|
||||||
nodelay,
|
nodelay,
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "default-tls")]
|
#[cfg(feature = "default-tls")]
|
||||||
@@ -181,21 +181,21 @@ impl Connector {
|
|||||||
proxies: Arc<Vec<Proxy>>,
|
proxies: Arc<Vec<Proxy>>,
|
||||||
user_agent: Option<HeaderValue>,
|
user_agent: Option<HeaderValue>,
|
||||||
local_addr: T,
|
local_addr: T,
|
||||||
nodelay: bool) -> crate::Result<Connector>
|
nodelay: bool) -> Connector
|
||||||
where
|
where
|
||||||
T: Into<Option<IpAddr>>,
|
T: Into<Option<IpAddr>>,
|
||||||
{
|
{
|
||||||
http.set_local_address(local_addr.into());
|
http.set_local_address(local_addr.into());
|
||||||
http.enforce_http(false);
|
http.enforce_http(false);
|
||||||
|
|
||||||
Ok(Connector {
|
Connector {
|
||||||
inner: Inner::DefaultTls(http, tls),
|
inner: Inner::DefaultTls(http, tls),
|
||||||
proxies,
|
proxies,
|
||||||
verbose: verbose::OFF,
|
verbose: verbose::OFF,
|
||||||
timeout: None,
|
timeout: None,
|
||||||
nodelay,
|
nodelay,
|
||||||
user_agent,
|
user_agent,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "rustls-tls")]
|
#[cfg(feature = "rustls-tls")]
|
||||||
@@ -206,7 +206,7 @@ impl Connector {
|
|||||||
user_agent: Option<HeaderValue>,
|
user_agent: Option<HeaderValue>,
|
||||||
local_addr: T,
|
local_addr: T,
|
||||||
nodelay: bool,
|
nodelay: bool,
|
||||||
) -> crate::Result<Connector>
|
) -> Connector
|
||||||
where
|
where
|
||||||
T: Into<Option<IpAddr>>,
|
T: Into<Option<IpAddr>>,
|
||||||
{
|
{
|
||||||
@@ -222,7 +222,7 @@ impl Connector {
|
|||||||
(Arc::new(tls), Arc::new(tls_proxy))
|
(Arc::new(tls), Arc::new(tls_proxy))
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Connector {
|
Connector {
|
||||||
inner: Inner::RustlsTls {
|
inner: Inner::RustlsTls {
|
||||||
http,
|
http,
|
||||||
tls,
|
tls,
|
||||||
@@ -233,7 +233,7 @@ impl Connector {
|
|||||||
timeout: None,
|
timeout: None,
|
||||||
nodelay,
|
nodelay,
|
||||||
user_agent,
|
user_agent,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_timeout(&mut self, timeout: Option<Duration>) {
|
pub(crate) fn set_timeout(&mut self, timeout: Option<Duration>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user