♻️ Revisa código con cargo fmt y cargo clippy
This commit is contained in:
parent
a43206bb0f
commit
9a8182508c
14 changed files with 41 additions and 46 deletions
|
|
@ -49,11 +49,14 @@ impl Application {
|
|||
let server = super::HttpServer::new(move || {
|
||||
super::App::new()
|
||||
.wrap(tracing_actix_web::TracingLogger::default())
|
||||
.configure(&module::all::configure_services)
|
||||
.configure(&theme::all::configure_services)
|
||||
.configure(module::all::configure_services)
|
||||
.configure(theme::all::configure_services)
|
||||
.default_service(super::web::route().to(service_not_found))
|
||||
})
|
||||
.bind(format!("{}:{}", &SETTINGS.server.bind_address, &SETTINGS.server.bind_port))?
|
||||
.bind(format!(
|
||||
"{}:{}",
|
||||
&SETTINGS.server.bind_address, &SETTINGS.server.bind_port
|
||||
))?
|
||||
.run();
|
||||
|
||||
Ok(Self { server })
|
||||
|
|
|
|||
|
|
@ -41,9 +41,8 @@ impl ComponentTrait for Block {
|
|||
let id = context.required_id::<Block>(self.id());
|
||||
html! {
|
||||
div id=(id) class=[self.classes().get()] {
|
||||
@match self.title().get() {
|
||||
Some(title) => h2 class="block-title" { (title) },
|
||||
None => {}
|
||||
@if let Some(title) = self.title().get() {
|
||||
h2 class="block-title" { (title) }
|
||||
}
|
||||
div class="block-body" {
|
||||
(self.components().render(context))
|
||||
|
|
|
|||
|
|
@ -60,10 +60,7 @@ impl ComponentTrait for Button {
|
|||
autofocus=[self.autofocus().get()]
|
||||
disabled=[self.disabled().get()]
|
||||
{
|
||||
@match self.value().get() {
|
||||
Some(value) => { (value) },
|
||||
None => {},
|
||||
}
|
||||
@if let Some(value) = self.value().get() { (value) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,17 +44,15 @@ impl ComponentTrait for Date {
|
|||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||
html! {
|
||||
div class=[self.classes().get()] {
|
||||
@match self.label().get() {
|
||||
Some(label) => label class="form-label" for=[&id] {
|
||||
@if let Some(label) = self.label().get() {
|
||||
label class="form-label" for=[&id] {
|
||||
(label) " "
|
||||
@match self.required().get() {
|
||||
Some(_) => span
|
||||
@if self.required().get().is_some() {
|
||||
span
|
||||
class="form-required"
|
||||
title="Este campo es obligatorio." { "*" } " ",
|
||||
None => {}
|
||||
title="Este campo es obligatorio." { "*" } " ";
|
||||
}
|
||||
},
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
input
|
||||
type="date"
|
||||
|
|
@ -68,9 +66,8 @@ impl ComponentTrait for Date {
|
|||
readonly=[self.readonly().get()]
|
||||
required=[self.required().get()]
|
||||
disabled=[self.disabled().get()];
|
||||
@match self.help_text().get() {
|
||||
Some(help_text) => div class="form-text" { (help_text) },
|
||||
None => {}
|
||||
@if let Some(help_text) = self.help_text().get() {
|
||||
div class="form-text" { (help_text) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,17 +70,15 @@ impl ComponentTrait for Input {
|
|||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||
html! {
|
||||
div class=[self.classes().get()] {
|
||||
@match self.label().get() {
|
||||
Some(label) => label class="form-label" for=[&id] {
|
||||
@if let Some(label) = self.label().get() {
|
||||
label class="form-label" for=[&id] {
|
||||
(label) " "
|
||||
@match self.required().get() {
|
||||
Some(_) => span
|
||||
@if self.required().get().is_some() {
|
||||
span
|
||||
class="form-required"
|
||||
title="Este campo es obligatorio." { "*" } " ",
|
||||
None => {}
|
||||
title="Este campo es obligatorio." { "*" } " ";
|
||||
}
|
||||
},
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
input
|
||||
type=(type_input)
|
||||
|
|
@ -97,9 +95,8 @@ impl ComponentTrait for Input {
|
|||
readonly=[self.readonly().get()]
|
||||
required=[self.required().get()]
|
||||
disabled=[self.disabled().get()];
|
||||
@match self.help_text().get() {
|
||||
Some(help_text) => div class="form-text" { (help_text) },
|
||||
None => {}
|
||||
@if let Some(help_text) = self.help_text().get() {
|
||||
div class="form-text" { (help_text) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ where
|
|||
{
|
||||
let mut settings = CONFIG_DATA.clone();
|
||||
for (key, value) in values.iter() {
|
||||
settings.set_default(*key, *value).unwrap();
|
||||
settings.set_default(key, *value).unwrap();
|
||||
}
|
||||
match settings.try_into() {
|
||||
Ok(c) => c,
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ impl<'de> de::EnumAccess<'de> for EnumAccess {
|
|||
let value = {
|
||||
let deserializer = match self.value.kind {
|
||||
ValueKind::String(ref s) => self.variant_deserializer(s),
|
||||
ValueKind::Table(ref t) => self.table_deserializer(&t),
|
||||
ValueKind::Table(ref t) => self.table_deserializer(t),
|
||||
_ => Err(self.structural_error()),
|
||||
}?;
|
||||
seed.deserialize(deserializer)?
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ impl ConfigError {
|
|||
|
||||
fn prepend(self, segment: String, add_dot: bool) -> Self {
|
||||
let concat = |key: Option<String>| {
|
||||
let key = key.unwrap_or_else(String::new);
|
||||
let dot = if add_dot && key.as_bytes().get(0).unwrap_or(&b'[') != &b'[' {
|
||||
let key = key.unwrap_or_default();
|
||||
let dot = if add_dot && key.as_bytes().first().unwrap_or(&b'[') != &b'[' {
|
||||
"."
|
||||
} else {
|
||||
""
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ fn sindex_to_uindex(index: isize, len: usize) -> usize {
|
|||
if index >= 0 {
|
||||
index as usize
|
||||
} else {
|
||||
len - (index.abs() as usize)
|
||||
len - (index.unsigned_abs())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ impl Expression {
|
|||
match value.kind {
|
||||
ValueKind::Table(ref incoming_map) => {
|
||||
// Pull out another table.
|
||||
let mut target = if let ValueKind::Table(ref mut map) = root.kind {
|
||||
let target = if let ValueKind::Table(ref mut map) = root.kind {
|
||||
map.entry(id.clone())
|
||||
.or_insert_with(|| HashMap::<String, Value>::new().into())
|
||||
} else {
|
||||
|
|
@ -116,7 +116,7 @@ impl Expression {
|
|||
|
||||
// Continue the deep merge.
|
||||
for (key, val) in incoming_map {
|
||||
Expression::Identifier(key.clone()).set(&mut target, val.clone());
|
||||
Expression::Identifier(key.clone()).set(target, val.clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,9 @@ impl Value {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::bool_to_int_with_if)]
|
||||
ValueKind::Boolean(value) => Ok(if value { 1 } else { 0 }),
|
||||
|
||||
ValueKind::Float(value) => Ok(value.round() as i64),
|
||||
|
||||
// Unexpected type
|
||||
|
|
@ -230,11 +232,13 @@ impl Value {
|
|||
Unexpected::Unit,
|
||||
"an integer",
|
||||
)),
|
||||
|
||||
ValueKind::Table(_) => Err(ConfigError::invalid_type(
|
||||
self.origin,
|
||||
Unexpected::Map,
|
||||
"an integer",
|
||||
)),
|
||||
|
||||
ValueKind::Array(_) => Err(ConfigError::invalid_type(
|
||||
self.origin,
|
||||
Unexpected::Seq,
|
||||
|
|
|
|||
|
|
@ -48,11 +48,9 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
|
|||
None => title { (SETTINGS.app.name) }
|
||||
}
|
||||
|
||||
@match page.description().get() {
|
||||
Some(d) => meta name="description" content=(d);,
|
||||
None => {}
|
||||
@if let Some(d) = page.description().get() {
|
||||
meta name="description" content=(d);
|
||||
}
|
||||
|
||||
meta http-equiv="X-UA-Compatible" content="IE=edge";
|
||||
meta name="viewport" content=(viewport);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use sea_schema::{mysql::MySql, postgres::Postgres, probe::SchemaProbe, sqlite::S
|
|||
|
||||
use super::{seaql_migrations, MigrationTrait, SchemaManager};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
/// Status of migration
|
||||
pub enum MigrationStatus {
|
||||
/// Not yet applied
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||||
#[derive(Clone, Debug, Eq, PartialEq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "seaql_migrations")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use super::AssetsTrait;
|
||||
use crate::html::{html, Markup};
|
||||
|
||||
#[derive(Default, PartialEq)]
|
||||
#[derive(Default, Eq, PartialEq)]
|
||||
pub enum ModeJS {
|
||||
Async,
|
||||
#[default]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue