From 39e835cfa390b9460d6d3762d7eeb74469a36eb9 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 16 Jul 2024 10:00:49 +0000 Subject: [PATCH] fmt --- src/web/settings.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/web/settings.rs b/src/web/settings.rs index 0fb0875..efaee12 100644 --- a/src/web/settings.rs +++ b/src/web/settings.rs @@ -1,13 +1,15 @@ -use axum::{ http::{header, StatusCode}, response::IntoResponse, Extension, Form}; +use axum::{ + http::{header, StatusCode}, + response::IntoResponse, + Extension, Form, +}; use axum_extra::extract::{cookie::Cookie, CookieJar}; use maud::{html, Markup, PreEscaped, DOCTYPE}; use serde::{Deserialize, Serialize}; use crate::{config::Config, web::head_html}; -pub async fn get( - Extension(config): Extension, -) -> impl IntoResponse { +pub async fn get(Extension(config): Extension) -> impl IntoResponse { let theme_option = |value: &str, name: &str| -> Markup { let selected = config.ui.stylesheet_url == value; html! { @@ -57,7 +59,7 @@ pub async fn get( } .into_string(); - ( [(header::CONTENT_TYPE, "text/html; charset=utf-8")], html) + ([(header::CONTENT_TYPE, "text/html; charset=utf-8")], html) } #[derive(Serialize, Deserialize)] @@ -67,17 +69,10 @@ pub struct Settings { pub stylesheet_str: String, } -pub async fn post( - mut jar: CookieJar, - Form(settings): Form, -) -> impl IntoResponse { +pub async fn post(mut jar: CookieJar, Form(settings): Form) -> impl IntoResponse { let mut settings_cookie = Cookie::new("settings", serde_json::to_string(&settings).unwrap()); settings_cookie.make_permanent(); jar = jar.add(settings_cookie); - ( - StatusCode::FOUND, - [(header::LOCATION, "/settings")], - jar - ) + (StatusCode::FOUND, [(header::LOCATION, "/settings")], jar) }