From f66d8c035475802c4ce4eac8b407be9386f9dbc3 Mon Sep 17 00:00:00 2001 From: Sylwester Fraczek Date: Tue, 25 Feb 2025 17:04:30 +0100 Subject: [PATCH] formatting fix --- src/csvparser.rs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/csvparser.rs b/src/csvparser.rs index 00de396..73b65aa 100644 --- a/src/csvparser.rs +++ b/src/csvparser.rs @@ -64,15 +64,23 @@ fn extract_cash(cashline: &str) -> Result { let mut pln_parser = tuple((double::<&str, Error<_>>, tag("PLN"))); if let Ok((_, (value, _))) = euro_parser(cashline_string.as_str()) { - return Ok(crate::Currency::EUR(value)); + return Ok(crate::Currency::EUR(value)); } else if let Ok((_, (value, _))) = pln_parser(cashline_string.as_str()) { - return Ok(crate::Currency::PLN(value)); + return Ok(crate::Currency::PLN(value)); } else if let Ok((_, (sign, _, value))) = usd_parser(cashline_string.as_str()) { - return Ok(crate::Currency::USD(if sign.len() == 1 { -value } else { value })); + return Ok(crate::Currency::USD(if sign.len() == 1 { + -value + } else { + value + })); } else if let Ok((_, (sign, value, _))) = usd_parser2(cashline_string.as_str()) { - return Ok(crate::Currency::USD(if sign.len() == 1 { -value } else { value })); + return Ok(crate::Currency::USD(if sign.len() == 1 { + -value + } else { + value + })); } else { - return Err(format!("Error converting: {cashline_string}")); + return Err(format!("Error converting: {cashline_string}")); } } @@ -234,10 +242,11 @@ fn parse_incomes(df: &DataFrame, col: &str) -> Result, Stri .utf8() .map_err(|_| format!("Error: Unable to convert column '{}' to utf8", col))?; - possible_incomes.into_iter() - .filter_map(|x| x) - .map(|d| extract_cash(&d)) - .collect() + possible_incomes + .into_iter() + .filter_map(|x| x) + .map(|d| extract_cash(&d)) + .collect() } fn parse_income_with_currency(