mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 06:57:43 +02:00
chore: disallow e bindings
This commit is contained in:
@ -54,11 +54,11 @@ impl std::error::Error for ConnectError {}
|
||||
impl From<actix_tls::connect::ConnectError> for ConnectError {
|
||||
fn from(err: actix_tls::connect::ConnectError) -> ConnectError {
|
||||
match err {
|
||||
actix_tls::connect::ConnectError::Resolver(e) => ConnectError::Resolver(e),
|
||||
actix_tls::connect::ConnectError::Resolver(err) => ConnectError::Resolver(err),
|
||||
actix_tls::connect::ConnectError::NoRecords => ConnectError::NoRecords,
|
||||
actix_tls::connect::ConnectError::InvalidInput => panic!(),
|
||||
actix_tls::connect::ConnectError::Unresolved => ConnectError::Unresolved,
|
||||
actix_tls::connect::ConnectError::Io(e) => ConnectError::Io(e),
|
||||
actix_tls::connect::ConnectError::Io(err) => ConnectError::Io(err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ use super::{
|
||||
Connect,
|
||||
};
|
||||
|
||||
#[derive(Hash, Eq, PartialEq, Clone, Debug)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Key {
|
||||
authority: Authority,
|
||||
}
|
||||
@ -42,8 +42,8 @@ impl From<Authority> for Key {
|
||||
}
|
||||
}
|
||||
|
||||
/// Connections pool to reuse I/O per [`Authority`].
|
||||
#[doc(hidden)]
|
||||
/// Connections pool for reuse Io type for certain [`http::uri::Authority`] as key.
|
||||
pub struct ConnectionPool<S, Io>
|
||||
where
|
||||
Io: AsyncWrite + Unpin + 'static,
|
||||
@ -52,7 +52,7 @@ where
|
||||
inner: ConnectionPoolInner<Io>,
|
||||
}
|
||||
|
||||
/// wrapper type for check the ref count of Rc.
|
||||
/// Wrapper type for check the ref count of Rc.
|
||||
pub struct ConnectionPoolInner<Io>(Rc<ConnectionPoolInnerPriv<Io>>)
|
||||
where
|
||||
Io: AsyncWrite + Unpin + 'static;
|
||||
@ -63,7 +63,7 @@ where
|
||||
{
|
||||
fn new(config: ConnectorConfig) -> Self {
|
||||
let permits = Arc::new(Semaphore::new(config.limit));
|
||||
let available = RefCell::new(HashMap::default());
|
||||
let available = RefCell::new(HashMap::new());
|
||||
|
||||
Self(Rc::new(ConnectionPoolInnerPriv {
|
||||
config,
|
||||
@ -72,7 +72,7 @@ where
|
||||
}))
|
||||
}
|
||||
|
||||
/// spawn a async for graceful shutdown h1 Io type with a timeout.
|
||||
/// Spawns a graceful shutdown task for the underlying I/O with a timeout.
|
||||
fn close(&self, conn: ConnectionInnerType<Io>) {
|
||||
if let Some(timeout) = self.config.disconnect_timeout {
|
||||
if let ConnectionInnerType::H1(io) = conn {
|
||||
|
@ -147,8 +147,8 @@ impl FrozenSendBuilder {
|
||||
|
||||
/// Complete request construction and send a body.
|
||||
pub fn send_body(self, body: impl MessageBody + 'static) -> SendClientRequest {
|
||||
if let Some(e) = self.err {
|
||||
return e.into();
|
||||
if let Some(err) = self.err {
|
||||
return err.into();
|
||||
}
|
||||
|
||||
RequestSender::Rc(self.req.head, Some(self.extra_headers)).send_body(
|
||||
@ -177,8 +177,8 @@ impl FrozenSendBuilder {
|
||||
|
||||
/// Complete request construction and send an urlencoded body.
|
||||
pub fn send_form(self, value: impl Serialize) -> SendClientRequest {
|
||||
if let Some(e) = self.err {
|
||||
return e.into();
|
||||
if let Some(err) = self.err {
|
||||
return err.into();
|
||||
}
|
||||
|
||||
RequestSender::Rc(self.req.head, Some(self.extra_headers)).send_form(
|
||||
@ -196,8 +196,8 @@ impl FrozenSendBuilder {
|
||||
S: Stream<Item = Result<Bytes, E>> + 'static,
|
||||
E: Into<BoxError> + 'static,
|
||||
{
|
||||
if let Some(e) = self.err {
|
||||
return e.into();
|
||||
if let Some(err) = self.err {
|
||||
return err.into();
|
||||
}
|
||||
|
||||
RequestSender::Rc(self.req.head, Some(self.extra_headers)).send_stream(
|
||||
@ -211,8 +211,8 @@ impl FrozenSendBuilder {
|
||||
|
||||
/// Complete request construction and send an empty body.
|
||||
pub fn send(self) -> SendClientRequest {
|
||||
if let Some(e) = self.err {
|
||||
return e.into();
|
||||
if let Some(err) = self.err {
|
||||
return err.into();
|
||||
}
|
||||
|
||||
RequestSender::Rc(self.req.head, Some(self.extra_headers)).send(
|
||||
|
@ -415,8 +415,8 @@ impl ClientRequest {
|
||||
|
||||
// allow unused mut when cookies feature is disabled
|
||||
fn prep_for_sending(#[allow(unused_mut)] mut self) -> Result<Self, PrepForSendingError> {
|
||||
if let Some(e) = self.err {
|
||||
return Err(e.into());
|
||||
if let Some(err) = self.err {
|
||||
return Err(err.into());
|
||||
}
|
||||
|
||||
// validate uri
|
||||
|
@ -54,8 +54,8 @@ impl From<PrepForSendingError> for FreezeRequestError {
|
||||
impl From<PrepForSendingError> for SendRequestError {
|
||||
fn from(err: PrepForSendingError) -> SendRequestError {
|
||||
match err {
|
||||
PrepForSendingError::Url(e) => SendRequestError::Url(e),
|
||||
PrepForSendingError::Http(e) => SendRequestError::Http(e),
|
||||
PrepForSendingError::Url(err) => SendRequestError::Url(err),
|
||||
PrepForSendingError::Http(err) => SendRequestError::Http(err),
|
||||
PrepForSendingError::Json(err) => {
|
||||
SendRequestError::Custom(Box::new(err), Box::new("json serialization error"))
|
||||
}
|
||||
@ -156,20 +156,20 @@ impl Future for SendClientRequest {
|
||||
}
|
||||
|
||||
impl From<SendRequestError> for SendClientRequest {
|
||||
fn from(e: SendRequestError) -> Self {
|
||||
SendClientRequest::Err(Some(e))
|
||||
fn from(err: SendRequestError) -> Self {
|
||||
SendClientRequest::Err(Some(err))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HttpError> for SendClientRequest {
|
||||
fn from(e: HttpError) -> Self {
|
||||
SendClientRequest::Err(Some(e.into()))
|
||||
fn from(err: HttpError) -> Self {
|
||||
SendClientRequest::Err(Some(err.into()))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PrepForSendingError> for SendClientRequest {
|
||||
fn from(e: PrepForSendingError) -> Self {
|
||||
SendClientRequest::Err(Some(e.into()))
|
||||
fn from(err: PrepForSendingError) -> Self {
|
||||
SendClientRequest::Err(Some(err.into()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,8 @@ impl WebsocketsRequest {
|
||||
pub async fn connect(
|
||||
mut self,
|
||||
) -> Result<(ClientResponse, Framed<BoxedSocket, Codec>), WsClientError> {
|
||||
if let Some(e) = self.err.take() {
|
||||
return Err(e.into());
|
||||
if let Some(err) = self.err.take() {
|
||||
return Err(err.into());
|
||||
}
|
||||
|
||||
// validate URI
|
||||
|
Reference in New Issue
Block a user