style: 💄 lint & fmt

This commit is contained in:
Lucas Colombo 2024-04-17 08:30:25 -03:00
parent 14b421a147
commit f26691a968
Signed by: lucas
GPG Key ID: EF34786CFEFFAE35
3 changed files with 15 additions and 15 deletions

View File

@ -1,4 +1,6 @@
#![doc(html_logo_url = "https://raw.githubusercontent.com/lucodear/lool/master/.github/img/logo.svg")] #![doc(
html_logo_url = "https://raw.githubusercontent.com/lucodear/lool/master/.github/img/logo.svg"
)]
#[cfg(feature = "cli")] #[cfg(feature = "cli")]
pub mod cli; pub mod cli;

View File

@ -38,19 +38,17 @@ where
if *step == T::zero() || *step == T::one() { if *step == T::zero() || *step == T::one() {
if *start < *end { if *start < *end {
return value >= *start && value <= *end; value >= *start && value <= *end
} else { } else {
return value >= *start || value <= *end; value >= *start || value <= *end
} }
} else if *start < *end {
value >= *start
&& value <= *end
&& (value - *start) % *step == T::zero()
} else { } else {
if *start < *end { (value >= *start || value <= *end)
return value >= *start && (*start - value) % *step == T::zero()
&& value <= *end
&& (value - *start) % *step == T::zero();
} else {
return (value >= *start || value <= *end)
&& (*start - value) % *step == T::zero();
}
} }
} }
Rule::Many(matcher) => matcher.iter().any(|v| Self::_matches(&Rule::Val(*v), value)), Rule::Many(matcher) => matcher.iter().any(|v| Self::_matches(&Rule::Val(*v), value)),

View File

@ -27,7 +27,7 @@ pub fn parse_time(time: &str) -> Result<(u32, u32, u32)> {
}; };
ensure!(seconds <= 59, INVALID_TIME_ERR); ensure!(seconds <= 59, INVALID_TIME_ERR);
Ok((hours as u32, minutes as u32, seconds as u32)) Ok((hours, minutes, seconds))
} }
/// 🧉 » converts `hours` and `minutes` durations to total seconds /// 🧉 » converts `hours` and `minutes` durations to total seconds
@ -59,10 +59,10 @@ pub fn tz_to_s(offset: &str) -> Result<i32> {
NO_SIGN_ERR NO_SIGN_ERR
); );
let offset = if offset.starts_with("UTC") { let offset = if let Some(offset) = offset.strip_prefix("UTC") {
offset[3..].to_string() offset
} else { } else {
offset.to_string() offset
}; };
let sign = if offset.starts_with('+') { 1 } else { -1 }; let sign = if offset.starts_with('+') { 1 } else { -1 };