From 6bf83dcbe604973664b3fe2ea1736573fdca05c2 Mon Sep 17 00:00:00 2001 From: xenofem Date: Thu, 26 May 2022 14:56:37 -0400 Subject: [PATCH] cargo fmt --- src/main.rs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 76ff8d9..2539635 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,8 @@ mod zip; use std::{fmt::Debug, path::PathBuf, str::FromStr}; use actix_web::{ - error::InternalError, get, middleware::Logger, post, web, App, HttpRequest, - HttpResponse, HttpServer, Responder, + error::InternalError, get, middleware::Logger, post, web, App, HttpRequest, HttpResponse, + HttpServer, Responder, }; use actix_web_actors::ws; use askama::Template; @@ -52,11 +52,19 @@ pub fn log_auth_failure(ip_addr: &str) { #[derive(Template)] #[template(path = "index.html")] -struct IndexPage<'a> { cachebuster: &'a str } +struct IndexPage<'a> { + cachebuster: &'a str, +} #[get("/")] async fn index(data: web::Data) -> impl Responder { - HttpResponse::Ok().body(IndexPage { cachebuster: &data.config.cachebuster }.render().unwrap()) + HttpResponse::Ok().body( + IndexPage { + cachebuster: &data.config.cachebuster, + } + .render() + .unwrap(), + ) } #[derive(Deserialize)] @@ -168,7 +176,9 @@ async fn download_info( #[derive(Template)] #[template(path = "404.html")] -struct NotFoundPage<'a> { cachebuster: &'a str } +struct NotFoundPage<'a> { + cachebuster: &'a str, +} fn not_found(req: HttpRequest, data: web::Data, report: bool) -> actix_web::Result { if report { @@ -177,7 +187,13 @@ fn not_found(req: HttpRequest, data: web::Data, report: bool) -> ac } Err(InternalError::from_response( "Download not found", - HttpResponse::NotFound().body(NotFoundPage { cachebuster: &data.config.cachebuster }.render().unwrap()), + HttpResponse::NotFound().body( + NotFoundPage { + cachebuster: &data.config.cachebuster, + } + .render() + .unwrap(), + ), ) .into()) }