style: 💄 lint & fmt
This commit is contained in:
parent
14b421a147
commit
f26691a968
@ -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;
|
||||||
|
|||||||
@ -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 {
|
} else if *start < *end {
|
||||||
if *start < *end {
|
value >= *start
|
||||||
return value >= *start
|
|
||||||
&& value <= *end
|
&& value <= *end
|
||||||
&& (value - *start) % *step == T::zero();
|
&& (value - *start) % *step == T::zero()
|
||||||
} else {
|
} else {
|
||||||
return (value >= *start || value <= *end)
|
(value >= *start || value <= *end)
|
||||||
&& (*start - value) % *step == T::zero();
|
&& (*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)),
|
||||||
|
|||||||
@ -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 };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user