From f1932d6749e1e94dbc08f8d2fb84a9c918180edf Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Thu, 10 Nov 2022 23:56:49 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Revisa=20c=C3=B3digo=20con?= =?UTF-8?q?=20cargo=20fmt=20y=20cargo=20clippy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagetop/src/app/application.rs | 3 ++- pagetop/src/app/banner/figfont.rs | 30 +++++++++++++++------------- pagetop/src/app/db.rs | 13 ++++++------ pagetop/src/base/module/homepage.rs | 17 +++++++--------- pagetop/src/config.rs | 3 +-- pagetop/src/core/theme/definition.rs | 2 +- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/pagetop/src/app/application.rs b/pagetop/src/app/application.rs index 2bd53e00..2c0b9c4c 100644 --- a/pagetop/src/app/application.rs +++ b/pagetop/src/app/application.rs @@ -55,7 +55,8 @@ impl Application { }) .bind(format!( "{}:{}", - &config::SETTINGS.server.bind_address, &config::SETTINGS.server.bind_port + &config::SETTINGS.server.bind_address, + &config::SETTINGS.server.bind_port ))? .run(); diff --git a/pagetop/src/app/banner/figfont.rs b/pagetop/src/app/banner/figfont.rs index f024c7f9..48ce038b 100644 --- a/pagetop/src/app/banner/figfont.rs +++ b/pagetop/src/app/banner/figfont.rs @@ -8,19 +8,21 @@ pub static FIGFONT: LazyStatic = LazyStatic::new(|| { let speed = include_str!("speed.flf"); let starwars = include_str!("starwars.flf"); - FIGfont::from_content(match config::SETTINGS.app.startup_banner.to_lowercase().as_str() { - "off" => slant, - "slant" => slant, - "small" => small, - "speed" => speed, - "starwars" => starwars, - _ => { - println!( - "\n FIGfont \"{}\" not found for banner. Using \"Slant\". Check settings files.", - config::SETTINGS.app.startup_banner, - ); - slant - } - }) + FIGfont::from_content( + match config::SETTINGS.app.startup_banner.to_lowercase().as_str() { + "off" => slant, + "slant" => slant, + "small" => small, + "speed" => speed, + "starwars" => starwars, + _ => { + println!( + "\n FIGfont \"{}\" not found for banner. Using \"Slant\". Check settings files.", + config::SETTINGS.app.startup_banner, + ); + slant + } + }, + ) .unwrap() }); diff --git a/pagetop/src/app/db.rs b/pagetop/src/app/db.rs index 5827e7b0..59e73156 100644 --- a/pagetop/src/app/db.rs +++ b/pagetop/src/app/db.rs @@ -1,5 +1,5 @@ -use crate::{config, run_now, trace, LazyStatic}; use crate::db::*; +use crate::{config, run_now, trace, LazyStatic}; use sea_orm::{ConnectOptions, ConnectionTrait, Database, DatabaseBackend, Statement}; use tracing_unwrap::ResultExt; @@ -31,14 +31,17 @@ pub static DBCONN: LazyStatic = LazyStatic::new(|| { .set_password(Some(config::SETTINGS.database.db_pass.as_str())) .unwrap(); if config::SETTINGS.database.db_port != 0 { - tmp_uri.set_port(Some(config::SETTINGS.database.db_port)).unwrap(); + tmp_uri + .set_port(Some(config::SETTINGS.database.db_port)) + .unwrap(); } tmp_uri } "sqlite" => DbUri::parse( format!( "{}://{}", - &config::SETTINGS.database.db_type, &config::SETTINGS.database.db_name + &config::SETTINGS.database.db_type, + &config::SETTINGS.database.db_name ) .as_str(), ) @@ -60,9 +63,7 @@ pub static DBCONN: LazyStatic = LazyStatic::new(|| { .expect_or_log("Failed to connect to database") }); -static DBBACKEND: LazyStatic = LazyStatic::new(|| - DBCONN.get_database_backend() -); +static DBBACKEND: LazyStatic = LazyStatic::new(|| DBCONN.get_database_backend()); pub async fn query(stmt: &mut Q) -> Result, DbErr> { DBCONN diff --git a/pagetop/src/base/module/homepage.rs b/pagetop/src/base/module/homepage.rs index 36ebae3c..c2830b91 100644 --- a/pagetop/src/base/module/homepage.rs +++ b/pagetop/src/base/module/homepage.rs @@ -82,19 +82,16 @@ fn hello_world() -> Container { .with_classes(ClassesOp::Add, "code-link"), ) .with_component( - Anchor::link( - "#welcome", - html! { (l("hello_welcome")) }, - ) - .with_left_icon(Icon::with("arrow-down-circle-fill")) - .with_classes(ClassesOp::Add, "welcome-link"), + Anchor::link("#welcome", html! { (l("hello_welcome")) }) + .with_left_icon(Icon::with("arrow-down-circle-fill")) + .with_classes(ClassesOp::Add, "welcome-link"), ), ) .with_column( grid::Column::new() .with_classes(ClassesOp::Add, "hello-col-image") .with_component(Image::new_with_source("/theme/images/homepage-header.svg")), - ) + ), ) } @@ -158,7 +155,7 @@ fn about_pagetop() -> Container { ) ])) })), - ) + ), ) } @@ -189,7 +186,7 @@ fn promo_pagetop() -> Container { .with_classes(ClassesOp::Add, "promo-col-image") .with_size(grid::ColumnSize::Is6of12) .with_component(Image::new_with_source("/theme/images/homepage-pagetop.png")), - ) + ), ) } @@ -217,6 +214,6 @@ fn reporting_problems() -> Container { .with_component(Paragraph::with(html! { (l("report_problems_text2")) })), - ) + ), ) } diff --git a/pagetop/src/config.rs b/pagetop/src/config.rs index c795c27a..8269123d 100644 --- a/pagetop/src/config.rs +++ b/pagetop/src/config.rs @@ -164,7 +164,7 @@ pub static CONFIG: LazyStatic = LazyStatic::new(|| { /// /// Ver [`Cómo añadir ajustes de configuración`](config/index.html#cómo-añadir-ajustes-de-configuración). macro_rules! pub_config { - ( $S:ident: $t:ty $(, $k:literal => $v:literal)*$(,)* ) => { crate::doc_comment! { + ( $S:ident: $t:ty $(, $k:literal => $v:literal)*$(,)* ) => { $crate::doc_comment! { concat!( "Declara y asigna los valores predefinidos para los ajustes de configuración ", "asociados a la estructura [`", stringify!($t), "`]." @@ -182,7 +182,6 @@ macro_rules! pub_config { }}; } - #[derive(Debug, Deserialize)] /// Ajustes globales para las secciones reservadas [`[app]`](App), [`[database]`](Database), /// [`[dev]`](Dev), [`[log]`](Log) y [`[server]`](Server) (ver [`SETTINGS`]). diff --git a/pagetop/src/core/theme/definition.rs b/pagetop/src/core/theme/definition.rs index c26ebae5..37b270ae 100644 --- a/pagetop/src/core/theme/definition.rs +++ b/pagetop/src/core/theme/definition.rs @@ -1,9 +1,9 @@ -use crate::{app, concat_string, config}; use crate::base::component::{Container, Html}; use crate::core::component::ComponentTrait; use crate::html::{html, Favicon, Markup}; use crate::response::page::{Page, PageContext, PageOp}; use crate::util::{single_type_name, Handle}; +use crate::{app, concat_string, config}; pub type ThemeStaticRef = &'static dyn ThemeTrait;