From 857832e0529bc8f6d0d089248d94dc0d78a58c1e Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Wed, 21 Jun 2023 13:24:58 -0700 Subject: [PATCH] cargo fmt --- src/cookies.rs | 2 +- src/i18n.rs | 15 ++++++--------- src/main.rs | 4 ++-- src/routes/get_challenge.rs | 7 ++++++- src/utils/headers.rs | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/cookies.rs b/src/cookies.rs index 0e72b9d..31858f1 100644 --- a/src/cookies.rs +++ b/src/cookies.rs @@ -8,4 +8,4 @@ pub mod user { pub const USER_DISCRIMINATOR_COOKIE: &str = "user_discriminator"; pub const USER_AVATAR_COOKIE: &str = "user_avatar"; } -pub const LANG_COOKIE: &str = "lang"; \ No newline at end of file +pub const LANG_COOKIE: &str = "lang"; diff --git a/src/i18n.rs b/src/i18n.rs index c2cfece..d588ba9 100644 --- a/src/i18n.rs +++ b/src/i18n.rs @@ -56,14 +56,11 @@ pub fn load_catalogs() -> Result<(Catalogs, Vec), LoadCatalogsError> { } let langs = catalogs .iter() - .map(|(code, catalog)| - LangCode { - code: code.clone(), - name: catalog - .gettext("lang") - .to_owned(), - } - ).collect(); + .map(|(code, catalog)| LangCode { + code: code.clone(), + name: catalog.gettext("lang").to_owned(), + }) + .collect(); Ok((catalogs, langs)) } @@ -108,4 +105,4 @@ pub fn langs_filter( langs: &Vec, ) -> tera::Result { Ok(serde_json::to_value(langs).unwrap()) -} \ No newline at end of file +} diff --git a/src/main.rs b/src/main.rs index dec2b2e..4d97985 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ extern crate rocket; use poise::serenity_prelude::Http; -use rocket::{fs::{relative, FileServer}}; +use rocket::fs::{relative, FileServer}; use rocket_dyn_templates::{tera, Template}; use sass_rocket_fairing::SassFairing; use std::{collections::HashMap, env}; @@ -58,7 +58,7 @@ async fn rocket() -> _ { "langs", move |value: &Value, args: &HashMap| { langs_filter(value, args, &langs) - } + }, ) })) .attach(SassFairing::default()) diff --git a/src/routes/get_challenge.rs b/src/routes/get_challenge.rs index dadfb61..f9f370d 100644 --- a/src/routes/get_challenge.rs +++ b/src/routes/get_challenge.rs @@ -3,7 +3,12 @@ use std::ops::Deref; use rocket::{http::CookieJar, State}; use rocket_dyn_templates::{context, Template}; -use crate::{models::{Challenge, Settings, User}, cookies::LANG_COOKIE, i18n::DEFAULT as DEFAULT_LANG, utils::AcceptLanguage}; +use crate::{ + cookies::LANG_COOKIE, + i18n::DEFAULT as DEFAULT_LANG, + models::{Challenge, Settings, User}, + utils::AcceptLanguage, +}; #[get("/")] pub async fn get_challenge( diff --git a/src/utils/headers.rs b/src/utils/headers.rs index 2290bb4..2479a61 100644 --- a/src/utils/headers.rs +++ b/src/utils/headers.rs @@ -27,4 +27,4 @@ macro_rules! header { header!(Referer, "Referer"); header!(AcceptLanguage, "Accept-Language", Vec, |header| { accept_language::parse(header) -}); \ No newline at end of file +});