cargo clippy & cargo fmt

This commit is contained in:
Pierre HUBERT 2022-04-03 14:31:57 +02:00
parent d2daeb5879
commit 8574a328c9

View File

@ -3,10 +3,10 @@ use std::path::{Path, PathBuf};
use actix_files::{Files, NamedFile}; use actix_files::{Files, NamedFile};
use actix_multipart::Multipart; use actix_multipart::Multipart;
use actix_web::{App, Error, HttpRequest, HttpResponse, HttpServer, web};
use actix_web::dev::{fn_service, ServiceRequest, ServiceResponse}; use actix_web::dev::{fn_service, ServiceRequest, ServiceResponse};
use actix_web::error::{ErrorBadRequest, ErrorInternalServerError, ErrorUnauthorized}; use actix_web::error::{ErrorBadRequest, ErrorInternalServerError, ErrorUnauthorized};
use actix_web::middleware::Logger; use actix_web::middleware::Logger;
use actix_web::{web, App, Error, HttpRequest, HttpResponse, HttpServer};
use bytes::BufMut; use bytes::BufMut;
use clap::Parser; use clap::Parser;
use futures_util::TryStreamExt; use futures_util::TryStreamExt;
@ -224,9 +224,11 @@ async fn default_files_handler(req: ServiceRequest) -> Result<ServiceResponse, E
// Search for alternate paths // Search for alternate paths
if args.can_bypass_html_ext if args.can_bypass_html_ext
&& !req.path().ends_with(".html") && !req.path().ends_with(".html")
&& !req.path().ends_with("/") && !req.path().ends_with('/')
&& !req.path().is_empty() { && !req.path().is_empty()
let alt_file = args.storage_path() {
let alt_file = args
.storage_path()
.join(format!("{}.html", &req.path()[1..])); .join(format!("{}.html", &req.path()[1..]));
if alt_file.exists() { if alt_file.exists() {
@ -242,7 +244,6 @@ async fn default_files_handler(req: ServiceRequest) -> Result<ServiceResponse, E
let res = file.into_response(&req); let res = file.into_response(&req);
Ok(ServiceResponse::new(req, res)) Ok(ServiceResponse::new(req, res))
} }
// Dummy response // Dummy response
else { else {
Ok(ServiceResponse::new( Ok(ServiceResponse::new(
@ -281,7 +282,7 @@ async fn main() -> std::io::Result<()> {
.wrap(Logger::default()) .wrap(Logger::default())
.app_data(web::Data::new(args.clone())) .app_data(web::Data::new(args.clone()))
}) })
.bind(listen_address)? .bind(listen_address)?
.run() .run()
.await .await
} }