♻️ Revisa código con cargo fmt y cargo clippy

This commit is contained in:
Manuel Cillero 2022-11-10 23:56:49 +01:00
parent 46d4e19c39
commit f1932d6749
6 changed files with 34 additions and 34 deletions

View file

@ -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();

View file

@ -8,19 +8,21 @@ pub static FIGFONT: LazyStatic<FIGfont> = 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()
});

View file

@ -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<DbConn> = 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<DbConn> = LazyStatic::new(|| {
.expect_or_log("Failed to connect to database")
});
static DBBACKEND: LazyStatic<DatabaseBackend> = LazyStatic::new(||
DBCONN.get_database_backend()
);
static DBBACKEND: LazyStatic<DatabaseBackend> = LazyStatic::new(|| DBCONN.get_database_backend());
pub async fn query<Q: QueryStatementWriter>(stmt: &mut Q) -> Result<Vec<QueryResult>, DbErr> {
DBCONN

View file

@ -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"))
})),
)
),
)
}

View file

@ -164,7 +164,7 @@ pub static CONFIG: LazyStatic<ConfigData> = 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`]).

View file

@ -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;