mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
address clippy warnings
This commit is contained in:
parent
5e81105317
commit
95130fcfd0
@ -382,7 +382,7 @@ impl WebsocketsRequest {
|
|||||||
if let Some(hdr_key) = head.headers.get(&header::SEC_WEBSOCKET_ACCEPT) {
|
if let Some(hdr_key) = head.headers.get(&header::SEC_WEBSOCKET_ACCEPT) {
|
||||||
let encoded = ws::hash_key(key.as_ref());
|
let encoded = ws::hash_key(key.as_ref());
|
||||||
|
|
||||||
if hdr_key.as_bytes() != &encoded {
|
if hdr_key.as_bytes() != encoded {
|
||||||
log::trace!(
|
log::trace!(
|
||||||
"Invalid challenge response: expected: {:?} received: {:?}",
|
"Invalid challenge response: expected: {:?} received: {:?}",
|
||||||
&encoded,
|
&encoded,
|
||||||
|
@ -30,7 +30,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
.service(
|
.service(
|
||||||
web::resource("/resource2/index.html")
|
web::resource("/resource2/index.html")
|
||||||
.wrap(middleware::DefaultHeaders::new().header("X-Version-R2", "0.3"))
|
.wrap(middleware::DefaultHeaders::new().header("X-Version-R2", "0.3"))
|
||||||
.default_service(web::route().to(|| HttpResponse::MethodNotAllowed()))
|
.default_service(web::route().to(HttpResponse::MethodNotAllowed))
|
||||||
.route(web::get().to(index_async)),
|
.route(web::get().to(index_async)),
|
||||||
)
|
)
|
||||||
.service(web::resource("/test1.html").to(|| async { "Test\r\n" }))
|
.service(web::resource("/test1.html").to(|| async { "Test\r\n" }))
|
||||||
|
@ -34,7 +34,7 @@ async fn main() -> std::io::Result<()> {
|
|||||||
.service(
|
.service(
|
||||||
web::resource("/resource2/index.html")
|
web::resource("/resource2/index.html")
|
||||||
.wrap(middleware::DefaultHeaders::new().header("X-Version-R2", "0.3"))
|
.wrap(middleware::DefaultHeaders::new().header("X-Version-R2", "0.3"))
|
||||||
.default_service(web::route().to(|| HttpResponse::MethodNotAllowed()))
|
.default_service(web::route().to(HttpResponse::MethodNotAllowed))
|
||||||
.route(web::get().to(index_async)),
|
.route(web::get().to(index_async)),
|
||||||
)
|
)
|
||||||
.service(web::resource("/test1.html").to(|| async { "Test\r\n" }))
|
.service(web::resource("/test1.html").to(|| async { "Test\r\n" }))
|
||||||
|
@ -106,6 +106,7 @@ mod tests {
|
|||||||
HttpResponse,
|
HttpResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
fn render_500<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
fn render_500<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||||
res.response_mut()
|
res.response_mut()
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
|
@ -182,6 +182,7 @@ mod tests {
|
|||||||
use crate::test::{self, TestRequest};
|
use crate::test::{self, TestRequest};
|
||||||
use crate::HttpResponse;
|
use crate::HttpResponse;
|
||||||
|
|
||||||
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
fn render_500<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
fn render_500<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||||
res.response_mut()
|
res.response_mut()
|
||||||
.headers_mut()
|
.headers_mut()
|
||||||
@ -205,6 +206,7 @@ mod tests {
|
|||||||
assert_eq!(resp.headers().get(CONTENT_TYPE).unwrap(), "0001");
|
assert_eq!(resp.headers().get(CONTENT_TYPE).unwrap(), "0001");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
fn render_500_async<B: 'static>(
|
fn render_500_async<B: 'static>(
|
||||||
mut res: ServiceResponse<B>,
|
mut res: ServiceResponse<B>,
|
||||||
) -> Result<ErrorHandlerResponse<B>> {
|
) -> Result<ErrorHandlerResponse<B>> {
|
||||||
|
@ -72,7 +72,7 @@ async fn test_start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "openssl")]
|
#[cfg(feature = "openssl")]
|
||||||
fn ssl_acceptor() -> std::io::Result<SslAcceptorBuilder> {
|
fn ssl_acceptor() -> SslAcceptorBuilder {
|
||||||
use openssl::{
|
use openssl::{
|
||||||
pkey::PKey,
|
pkey::PKey,
|
||||||
ssl::{SslAcceptor, SslMethod},
|
ssl::{SslAcceptor, SslMethod},
|
||||||
@ -102,7 +102,7 @@ async fn test_start_ssl() {
|
|||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let sys = actix_rt::System::new();
|
let sys = actix_rt::System::new();
|
||||||
let builder = ssl_acceptor().unwrap();
|
let builder = ssl_acceptor();
|
||||||
|
|
||||||
let srv = HttpServer::new(|| {
|
let srv = HttpServer::new(|| {
|
||||||
App::new().service(web::resource("/").route(web::to(|req: HttpRequest| {
|
App::new().service(web::resource("/").route(web::to(|req: HttpRequest| {
|
||||||
|
Loading…
Reference in New Issue
Block a user