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) {
|
||||
let encoded = ws::hash_key(key.as_ref());
|
||||
|
||||
if hdr_key.as_bytes() != &encoded {
|
||||
if hdr_key.as_bytes() != encoded {
|
||||
log::trace!(
|
||||
"Invalid challenge response: expected: {:?} received: {:?}",
|
||||
&encoded,
|
||||
|
@ -30,7 +30,7 @@ async fn main() -> std::io::Result<()> {
|
||||
.service(
|
||||
web::resource("/resource2/index.html")
|
||||
.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)),
|
||||
)
|
||||
.service(web::resource("/test1.html").to(|| async { "Test\r\n" }))
|
||||
|
@ -34,7 +34,7 @@ async fn main() -> std::io::Result<()> {
|
||||
.service(
|
||||
web::resource("/resource2/index.html")
|
||||
.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)),
|
||||
)
|
||||
.service(web::resource("/test1.html").to(|| async { "Test\r\n" }))
|
||||
|
@ -106,6 +106,7 @@ mod tests {
|
||||
HttpResponse,
|
||||
};
|
||||
|
||||
#[allow(clippy::unnecessary_wraps)]
|
||||
fn render_500<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||
res.response_mut()
|
||||
.headers_mut()
|
||||
|
@ -182,6 +182,7 @@ mod tests {
|
||||
use crate::test::{self, TestRequest};
|
||||
use crate::HttpResponse;
|
||||
|
||||
#[allow(clippy::unnecessary_wraps)]
|
||||
fn render_500<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||
res.response_mut()
|
||||
.headers_mut()
|
||||
@ -205,6 +206,7 @@ mod tests {
|
||||
assert_eq!(resp.headers().get(CONTENT_TYPE).unwrap(), "0001");
|
||||
}
|
||||
|
||||
#[allow(clippy::unnecessary_wraps)]
|
||||
fn render_500_async<B: 'static>(
|
||||
mut res: ServiceResponse<B>,
|
||||
) -> Result<ErrorHandlerResponse<B>> {
|
||||
|
@ -72,7 +72,7 @@ async fn test_start() {
|
||||
}
|
||||
|
||||
#[cfg(feature = "openssl")]
|
||||
fn ssl_acceptor() -> std::io::Result<SslAcceptorBuilder> {
|
||||
fn ssl_acceptor() -> SslAcceptorBuilder {
|
||||
use openssl::{
|
||||
pkey::PKey,
|
||||
ssl::{SslAcceptor, SslMethod},
|
||||
@ -102,7 +102,7 @@ async fn test_start_ssl() {
|
||||
|
||||
thread::spawn(move || {
|
||||
let sys = actix_rt::System::new();
|
||||
let builder = ssl_acceptor().unwrap();
|
||||
let builder = ssl_acceptor();
|
||||
|
||||
let srv = HttpServer::new(|| {
|
||||
App::new().service(web::resource("/").route(web::to(|req: HttpRequest| {
|
||||
|
Loading…
Reference in New Issue
Block a user