1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 22:49:21 +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

@ -137,7 +137,7 @@ pub(crate) trait MessageType: Sized {
expect = true;
}
}
_ => (),
_ => {},
}
headers.append(name, value);
@ -685,7 +685,7 @@ mod tests {
match MessageDecoder::<Request>::default().decode($e) {
Err(err) => match err {
ParseError::Io(_) => unreachable!("Parse error expected"),
_ => (),
_ => {},
},
_ => unreachable!("Error expected"),
}

View File

@ -736,7 +736,7 @@ where
let _ = this.ka_timer.as_mut().as_pin_mut().unwrap().poll(cx);
}
}
Poll::Pending => (),
Poll::Pending => {},
}
Ok(())

View File

@ -21,7 +21,7 @@ const AVERAGE_HEADER_SIZE: usize = 30;
pub(crate) struct MessageEncoder<T: MessageType> {
pub length: BodySize,
pub te: TransferEncoding,
_t: PhantomData<T>,
_phantom: PhantomData<T>,
}
impl<T: MessageType> Default for MessageEncoder<T> {
@ -29,7 +29,7 @@ impl<T: MessageType> Default for MessageEncoder<T> {
MessageEncoder {
length: BodySize::None,
te: TransferEncoding::empty(),
_t: PhantomData,
_phantom: PhantomData,
}
}
}
@ -118,7 +118,7 @@ pub(crate) trait MessageType: Sized {
dst.put_slice(b"connection: close\r\n")
}
}
_ => (),
_ => {},
}
// merging headers from head and extra headers. HeaderMap::new() does not allocate.
@ -148,7 +148,7 @@ pub(crate) trait MessageType: Sized {
CONNECTION => continue,
TRANSFER_ENCODING | CONTENT_LENGTH if skip_len => continue,
DATE => has_date = true,
_ => (),
_ => {},
}
let k = key.as_str().as_bytes();

View File

@ -30,7 +30,7 @@ pub struct H1Service<T, S, B, X = ExpectHandler, U = UpgradeHandler> {
expect: X,
upgrade: Option<U>,
on_connect_ext: Option<Rc<ConnectCallback<T>>>,
_t: PhantomData<B>,
_phantom: PhantomData<B>,
}
impl<T, S, B> H1Service<T, S, B>
@ -52,7 +52,7 @@ where
expect: ExpectHandler,
upgrade: None,
on_connect_ext: None,
_t: PhantomData,
_phantom: PhantomData,
}
}
}
@ -211,7 +211,7 @@ where
srv: self.srv,
upgrade: self.upgrade,
on_connect_ext: self.on_connect_ext,
_t: PhantomData,
_phantom: PhantomData,
}
}
@ -227,7 +227,7 @@ where
srv: self.srv,
expect: self.expect,
on_connect_ext: self.on_connect_ext,
_t: PhantomData,
_phantom: PhantomData,
}
}
@ -270,7 +270,7 @@ where
upgrade: None,
on_connect_ext: self.on_connect_ext.clone(),
cfg: Some(self.cfg.clone()),
_t: PhantomData,
_phantom: PhantomData,
}
}
}
@ -299,7 +299,7 @@ where
upgrade: Option<U::Service>,
on_connect_ext: Option<Rc<ConnectCallback<T>>>,
cfg: Option<ServiceConfig>,
_t: PhantomData<(T, B)>,
_phantom: PhantomData<(T, B)>,
}
impl<T, S, B, X, U> Future for H1ServiceResponse<T, S, B, X, U>
@ -371,7 +371,7 @@ where
upgrade: Option<CloneableService<U>>,
on_connect_ext: Option<Rc<ConnectCallback<T>>>,
cfg: ServiceConfig,
_t: PhantomData<B>,
_phantom: PhantomData<B>,
}
impl<T, S, B, X, U> H1ServiceHandler<T, S, B, X, U>
@ -398,7 +398,7 @@ where
upgrade: upgrade.map(CloneableService::new),
cfg,
on_connect_ext,
_t: PhantomData,
_phantom: PhantomData,
}
}
}