fix clippy warnings

This commit is contained in:
Alain Zscheile 2022-10-14 12:15:13 +02:00
parent 954df2f86a
commit 6ec3af5999
3 changed files with 14 additions and 11 deletions

View file

@ -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::<String>();
v.2 += &" ".repeat(pdsp - v.3);
if is_ny.unwrap_or(false) {
table.add_row(row!["", "", "", ""]);
}

View file

@ -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<Self, Self::Err> {
Ok(match s {
"EUR" => Waehrung::EUR,
"USD" => Waehrung::USD,
"EUR" => Self::Eur,
"USD" => Self::Usd,
_ => return Err(parser_error::Waehrung),
})
}

View file

@ -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,