1
0
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:
Rob Ede
2022-09-25 20:54:17 +01:00
committed by GitHub
parent 172c4c7a0a
commit cc7145d41d
24 changed files with 58 additions and 67 deletions

View File

@ -97,7 +97,7 @@ where
type Target = ConnectionPoolInnerPriv<Io>;
fn deref(&self) -> &Self::Target {
&*self.0
&self.0
}
}

View File

@ -321,7 +321,7 @@ impl WebsocketsRequest {
// Generate a random key for the `Sec-WebSocket-Key` header which is a base64-encoded
// (see RFC 4648 §4) value that, when decoded, is 16 bytes in length (RFC 6455 §1.3).
let sec_key: [u8; 16] = rand::random();
let key = base64::encode(&sec_key);
let key = base64::encode(sec_key);
self.head.headers.insert(
header::SEC_WEBSOCKET_KEY,
@ -513,7 +513,7 @@ mod tests {
.origin("test-origin")
.max_frame_size(100)
.server_mode()
.protocols(&["v1", "v2"])
.protocols(["v1", "v2"])
.set_header_if_none(header::CONTENT_TYPE, "json")
.set_header_if_none(header::CONTENT_TYPE, "text")
.cookie(Cookie::build("cookie1", "value1").finish());

View File

@ -707,8 +707,7 @@ async fn client_cookie_handling() {
async move {
// Check cookies were sent correctly
let res: Result<(), Error> = req
.cookie("cookie1")
req.cookie("cookie1")
.ok_or(())
.and_then(|c1| {
if c1.value() == "value1" {
@ -725,16 +724,10 @@ async fn client_cookie_handling() {
Err(())
}
})
.map_err(|_| Error::from(IoError::from(ErrorKind::NotFound)));
.map_err(|_| Error::from(IoError::from(ErrorKind::NotFound)))?;
if let Err(e) = res {
Err(e)
} else {
// Send some cookies back
Ok::<_, Error>(
HttpResponse::Ok().cookie(cookie1).cookie(cookie2).finish(),
)
}
// Send some cookies back
Ok::<_, Error>(HttpResponse::Ok().cookie(cookie1).cookie(cookie2).finish())
}
}),
)