diff --git a/src/main.rs b/src/main.rs index f41cc7b..48cdf7a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,7 @@ fn main() { use { chrono::Datelike, itertools::Itertools, - prettytable::{cell, format, row, Table}, + prettytable::{format, row, Table}, rayon::prelude::*, std::{ collections::{BTreeMap, HashSet}, @@ -80,9 +80,9 @@ fn main() { match pres { Ok(tl) => { if tl.direction == simple_enums::TransactionDirection::Haben - && tl.waehrung == simple_enums::Waehrung::EUR + && tl.waehrung == simple_enums::Waehrung::Eur && !tl.p_other.is_empty() - && tl.p_other.find(" ZINS BIS ").is_none() + && !tl.p_other.contains(" ZINS BIS ") { idat.push(tl) } else { @@ -165,7 +165,7 @@ fn main() { if !hl_only || is_hl { let mut yearuhj = format!("{} {}I", k.0, if k.1 { "I" } else { "" }); let is_ny = prev_yuhj.as_ref().map(|i| i != &yearuhj); - v.2 += &std::iter::repeat(' ').take(pdsp - v.3).collect::(); + v.2 += &" ".repeat(pdsp - v.3); if is_ny.unwrap_or(false) { table.add_row(row!["", "", "", ""]); } diff --git a/src/simple_enums.rs b/src/simple_enums.rs index 6c33b87..68e518c 100644 --- a/src/simple_enums.rs +++ b/src/simple_enums.rs @@ -29,15 +29,18 @@ use { std::fmt, }; -#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] +#[derive(Clone, Copy, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum Waehrung { - EUR, - USD, + Eur, + Usd, } impl fmt::Display for Waehrung { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:?}", self) + write!(f, "{}", match self { + Self::Eur => "EUR", + Self::Usd => "USD", + }) } } @@ -46,8 +49,8 @@ impl std::str::FromStr for Waehrung { fn from_str(s: &str) -> Result { Ok(match s { - "EUR" => Waehrung::EUR, - "USD" => Waehrung::USD, + "EUR" => Self::Eur, + "USD" => Self::Usd, _ => return Err(parser_error::Waehrung), }) } diff --git a/src/transaction.rs b/src/transaction.rs index fb86996..8f27532 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -5,7 +5,7 @@ use thiserror::Error; pub type TransactionValue = fixed::types::U53F11; -#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] +#[derive(Clone, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] pub struct TransactionLine { pub d_buchungs: NaiveDate, pub d_valuta: NaiveDate,