Merge pull request #216 from cakebaker/refactor_rename_var_to_fix_typo

refactor: rename var to fix typo
This commit is contained in:
Sylvestre Ledru
2025-08-22 16:52:24 +02:00
committed by GitHub
+9 -9
View File
@@ -106,16 +106,16 @@ fn seconds(input: &mut &str) -> ModalResult<Relative> {
fn displacement(input: &mut &str) -> ModalResult<Relative> {
(opt(ordinal), s(alpha1), ago)
.verify_map(|(n, unit, ago): (Option<i32>, &str, bool)| {
let multipler = n.unwrap_or(1) * if ago { -1 } else { 1 };
let multiplier = n.unwrap_or(1) * if ago { -1 } else { 1 };
Some(match unit.strip_suffix('s').unwrap_or(unit) {
"year" => Relative::Years(multipler),
"month" => Relative::Months(multipler),
"fortnight" => Relative::Days(multipler.checked_mul(14)?),
"week" => Relative::Days(multipler.checked_mul(7)?),
"day" => Relative::Days(multipler),
"hour" => Relative::Hours(multipler),
"minute" | "min" => Relative::Minutes(multipler),
"second" | "sec" => Relative::Seconds(multipler as i64, 0),
"year" => Relative::Years(multiplier),
"month" => Relative::Months(multiplier),
"fortnight" => Relative::Days(multiplier.checked_mul(14)?),
"week" => Relative::Days(multiplier.checked_mul(7)?),
"day" => Relative::Days(multiplier),
"hour" => Relative::Hours(multiplier),
"minute" | "min" => Relative::Minutes(multiplier),
"second" | "sec" => Relative::Seconds(multiplier as i64, 0),
_ => return None,
})
})