1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 16:55:08 +02:00

improve code readability

This commit is contained in:
Rob Ede
2021-01-04 00:49:02 +00:00
parent e1683313ec
commit 21f6c9d7a5
34 changed files with 238 additions and 230 deletions

View File

@ -52,7 +52,7 @@ pub struct Connector<T, U> {
config: ConnectorConfig,
#[allow(dead_code)]
ssl: SslConnector,
_t: PhantomData<U>,
_phantom: PhantomData<U>,
}
trait Io: AsyncRead + AsyncWrite + Unpin {}
@ -72,7 +72,7 @@ impl Connector<(), ()> {
ssl: Self::build_ssl(vec![b"h2".to_vec(), b"http/1.1".to_vec()]),
connector: default_connector(),
config: ConnectorConfig::default(),
_t: PhantomData,
_phantom: PhantomData,
}
}
@ -126,7 +126,7 @@ impl<T, U> Connector<T, U> {
connector,
config: self.config,
ssl: self.ssl,
_t: PhantomData,
_phantom: PhantomData,
}
}
}
@ -468,11 +468,11 @@ mod connect_impl {
match req.uri.scheme_str() {
Some("https") | Some("wss") => Either::Right(InnerConnectorResponseB {
fut: self.ssl_pool.call(req),
_t: PhantomData,
_phantom: PhantomData,
}),
_ => Either::Left(InnerConnectorResponseA {
fut: self.tcp_pool.call(req),
_t: PhantomData,
_phantom: PhantomData,
}),
}
}
@ -486,7 +486,7 @@ mod connect_impl {
{
#[pin]
fut: <ConnectionPool<T, Io1> as Service<Connect>>::Future,
_t: PhantomData<Io2>,
_phantom: PhantomData<Io2>,
}
impl<T, Io1, Io2> Future for InnerConnectorResponseA<T, Io1, Io2>
@ -513,7 +513,7 @@ mod connect_impl {
{
#[pin]
fut: <ConnectionPool<T, Io2> as Service<Connect>>::Future,
_t: PhantomData<Io1>,
_phantom: PhantomData<Io1>,
}
impl<T, Io1, Io2> Future for InnerConnectorResponseB<T, Io1, Io2>

View File

@ -72,7 +72,7 @@ where
// send request body
match body.size() {
BodySize::None | BodySize::Empty | BodySize::Sized(0) => (),
BodySize::None | BodySize::Empty | BodySize::Sized(0) => {},
_ => send_body(body, Pin::new(&mut framed_inner)).await?,
};

View File

@ -89,7 +89,7 @@ where
CONNECTION | TRANSFER_ENCODING => continue, // http2 specific
CONTENT_LENGTH if skip_len => continue,
// DATE => has_date = true,
_ => (),
_ => {},
}
req.headers_mut().append(key, value.clone());
}

View File

@ -334,7 +334,7 @@ where
let mut read_buf = ReadBuf::new(&mut buf);
if let ConnectionType::H1(ref mut s) = io {
match Pin::new(s).poll_read(cx, &mut read_buf) {
Poll::Pending => (),
Poll::Pending => {},
Poll::Ready(Ok(())) if !read_buf.filled().is_empty() => {
if let Some(timeout) = self.config.disconnect_timeout {
if let ConnectionType::H1(io) = io {