mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
rust 1.64 clippy run (#2891)
This commit is contained in:
@ -131,7 +131,7 @@ mod foreign_impls {
|
||||
type Error = B::Error;
|
||||
|
||||
fn size(&self) -> BodySize {
|
||||
(&**self).size()
|
||||
(**self).size()
|
||||
}
|
||||
|
||||
fn poll_next(
|
||||
|
@ -42,7 +42,7 @@ pub async fn to_bytes<B: MessageBody>(body: B) -> Result<Bytes, B::Error> {
|
||||
let body = body.as_mut();
|
||||
|
||||
match ready!(body.poll_next(cx)) {
|
||||
Some(Ok(bytes)) => buf.extend_from_slice(&*bytes),
|
||||
Some(Ok(bytes)) => buf.extend_from_slice(&bytes),
|
||||
None => return Poll::Ready(Ok(())),
|
||||
Some(Err(err)) => return Poll::Ready(Err(err)),
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ async fn expect_handling() {
|
||||
|
||||
if let DispatcherState::Normal { ref inner } = h1.inner {
|
||||
let io = inner.io.as_ref().unwrap();
|
||||
let mut res = (&io.write_buf()[..]).to_owned();
|
||||
let mut res = io.write_buf()[..].to_owned();
|
||||
stabilize_date_header(&mut res);
|
||||
|
||||
assert_eq!(
|
||||
@ -699,7 +699,7 @@ async fn expect_eager() {
|
||||
|
||||
if let DispatcherState::Normal { ref inner } = h1.inner {
|
||||
let io = inner.io.as_ref().unwrap();
|
||||
let mut res = (&io.write_buf()[..]).to_owned();
|
||||
let mut res = io.write_buf()[..].to_owned();
|
||||
stabilize_date_header(&mut res);
|
||||
|
||||
// Despite the content-length header and even though the request payload has not
|
||||
|
@ -309,7 +309,7 @@ impl HeaderMap {
|
||||
pub fn get_all(&self, key: impl AsHeaderName) -> std::slice::Iter<'_, HeaderValue> {
|
||||
match self.get_value(key) {
|
||||
Some(value) => value.iter(),
|
||||
None => (&[]).iter(),
|
||||
None => [].iter(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,14 +113,14 @@ impl<P> Request<P> {
|
||||
#[inline]
|
||||
/// Http message part of the request
|
||||
pub fn head(&self) -> &RequestHead {
|
||||
&*self.head
|
||||
&self.head
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[doc(hidden)]
|
||||
/// Mutable reference to a HTTP message part of the request
|
||||
pub fn head_mut(&mut self) -> &mut RequestHead {
|
||||
&mut *self.head
|
||||
&mut self.head
|
||||
}
|
||||
|
||||
/// Mutable reference to the message's headers.
|
||||
|
@ -83,13 +83,13 @@ impl<B> Response<B> {
|
||||
/// Returns a reference to the head of this response.
|
||||
#[inline]
|
||||
pub fn head(&self) -> &ResponseHead {
|
||||
&*self.head
|
||||
&self.head
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the head of this response.
|
||||
#[inline]
|
||||
pub fn head_mut(&mut self) -> &mut ResponseHead {
|
||||
&mut *self.head
|
||||
&mut self.head
|
||||
}
|
||||
|
||||
/// Returns the status code of this response.
|
||||
|
@ -313,7 +313,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_parse_frame_no_mask() {
|
||||
let mut buf = BytesMut::from(&[0b0000_0001u8, 0b0000_0001u8][..]);
|
||||
buf.extend(&[1u8]);
|
||||
buf.extend([1u8]);
|
||||
|
||||
assert!(Parser::parse(&mut buf, true, 1024).is_err());
|
||||
|
||||
@ -326,7 +326,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_parse_frame_max_size() {
|
||||
let mut buf = BytesMut::from(&[0b0000_0001u8, 0b0000_0010u8][..]);
|
||||
buf.extend(&[1u8, 1u8]);
|
||||
buf.extend([1u8, 1u8]);
|
||||
|
||||
assert!(Parser::parse(&mut buf, true, 1).is_err());
|
||||
|
||||
@ -340,9 +340,9 @@ mod tests {
|
||||
fn test_parse_frame_max_size_recoverability() {
|
||||
let mut buf = BytesMut::new();
|
||||
// The first text frame with length == 2, payload doesn't matter.
|
||||
buf.extend(&[0b0000_0001u8, 0b0000_0010u8, 0b0000_0000u8, 0b0000_0000u8]);
|
||||
buf.extend([0b0000_0001u8, 0b0000_0010u8, 0b0000_0000u8, 0b0000_0000u8]);
|
||||
// Next binary frame with length == 2 and payload == `[0x1111_1111u8, 0x1111_1111u8]`.
|
||||
buf.extend(&[0b0000_0010u8, 0b0000_0010u8, 0b1111_1111u8, 0b1111_1111u8]);
|
||||
buf.extend([0b0000_0010u8, 0b0000_0010u8, 0b1111_1111u8, 0b1111_1111u8]);
|
||||
|
||||
assert_eq!(buf.len(), 8);
|
||||
assert!(matches!(
|
||||
|
@ -244,7 +244,7 @@ pub fn hash_key(key: &[u8]) -> [u8; 28] {
|
||||
};
|
||||
|
||||
let mut hash_b64 = [0; 28];
|
||||
let n = base64::encode_config_slice(&hash, base64::STANDARD, &mut hash_b64);
|
||||
let n = base64::encode_config_slice(hash, base64::STANDARD, &mut hash_b64);
|
||||
assert_eq!(n, 28);
|
||||
|
||||
hash_b64
|
||||
|
Reference in New Issue
Block a user