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:
@ -97,7 +97,7 @@ where
|
||||
type Target = ConnectionPoolInnerPriv<Io>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&*self.0
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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())
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
Reference in New Issue
Block a user