🎨 Colapsa if anidados sugeridos por clippy
This commit is contained in:
parent
1cab0ae9a0
commit
502c00c891
5 changed files with 29 additions and 29 deletions
|
|
@ -42,12 +42,12 @@ impl Component for Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup(&mut self, _cx: &Context) {
|
fn setup(&mut self, _cx: &Context) {
|
||||||
if let Self::Nav(nav) = self {
|
if let Self::Nav(nav) = self
|
||||||
if let Some(nav) = nav.get_mut() {
|
&& let Some(nav) = nav.get_mut()
|
||||||
|
{
|
||||||
nav.alter_prop(PropsOp::prepend_classes("navbar-nav"));
|
nav.alter_prop(PropsOp::prepend_classes("navbar-nav"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async fn prepare(&self, cx: &mut Context) -> Result<Markup, ComponentError> {
|
async fn prepare(&self, cx: &mut Context) -> Result<Markup, ComponentError> {
|
||||||
Ok(match self {
|
Ok(match self {
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,9 @@ impl ScaleSize {
|
||||||
// Añade el tamaño a la cadena de clases usando el prefijo dado.
|
// Añade el tamaño a la cadena de clases usando el prefijo dado.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn push_to(self, classes: &mut String, prefix: &str) {
|
pub(crate) fn push_to(self, classes: &mut String, prefix: &str) {
|
||||||
if !prefix.is_empty() {
|
if !prefix.is_empty()
|
||||||
if let Some(suffix) = self.suffix() {
|
&& let Some(suffix) = self.suffix()
|
||||||
|
{
|
||||||
if !classes.is_empty() {
|
if !classes.is_empty() {
|
||||||
classes.push(' ');
|
classes.push(' ');
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +63,6 @@ impl ScaleSize {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// **< BoxSide >************************************************************************************
|
// **< BoxSide >************************************************************************************
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -158,11 +158,11 @@ fn collect_resources_nested<P: AsRef<Path>>(
|
||||||
let entry = entry?;
|
let entry = entry?;
|
||||||
let path = entry.path();
|
let path = entry.path();
|
||||||
|
|
||||||
if let Some(ref filter) = filter {
|
if let Some(ref filter) = filter
|
||||||
if !filter(path.as_ref()) {
|
&& !filter(path.as_ref())
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
let nested = collect_resources(path, filter)?;
|
let nested = collect_resources(path, filter)?;
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,9 @@ impl Application {
|
||||||
// Nombre de la aplicación, ajustado al ancho del terminal si es necesario.
|
// Nombre de la aplicación, ajustado al ancho del terminal si es necesario.
|
||||||
let mut app_ff = String::new();
|
let mut app_ff = String::new();
|
||||||
let app_name = &global::SETTINGS.app.name;
|
let app_name = &global::SETTINGS.app.name;
|
||||||
if let Some((Width(term_width), _)) = terminal_size() {
|
if let Some((Width(term_width), _)) = terminal_size()
|
||||||
if term_width >= 80 {
|
&& term_width >= 80
|
||||||
|
{
|
||||||
let maxlen: usize = ((term_width / 10) - 2).into();
|
let maxlen: usize = ((term_width / 10) - 2).into();
|
||||||
let mut app: String = app_name.chars().take(maxlen).collect();
|
let mut app: String = app_name.chars().take(maxlen).collect();
|
||||||
if app_name.chars().count() > maxlen {
|
if app_name.chars().count() > maxlen {
|
||||||
|
|
@ -95,7 +96,6 @@ impl Application {
|
||||||
app_ff = ff.to_string();
|
app_ff = ff.to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if app_ff.is_empty() {
|
if app_ff.is_empty() {
|
||||||
println!("\n{app_name}");
|
println!("\n{app_name}");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,11 @@ impl Locale {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si la variante regional no existe, retrocede al idioma base (p. ej. "es").
|
// Si la variante regional no existe, retrocede al idioma base (p. ej. "es").
|
||||||
if let Some((base_lang, _)) = lang.split_once('-') {
|
if let Some((base_lang, _)) = lang.split_once('-')
|
||||||
if let Some(langid) = LANGUAGES.get(base_lang).map(|(langid, _)| langid) {
|
&& let Some(langid) = LANGUAGES.get(base_lang).map(|(langid, _)| langid)
|
||||||
|
{
|
||||||
return Self::Resolved(langid);
|
return Self::Resolved(langid);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// En caso contrario, indica que el idioma no está soportado.
|
// En caso contrario, indica que el idioma no está soportado.
|
||||||
Self::Unsupported(language.to_string())
|
Self::Unsupported(language.to_string())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue