Skip to content

Commit

Permalink
bump rust edition from 2021 to 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
ursjoss committed Feb 21, 2025
1 parent 2c9c7d3 commit f9099f3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "lola-sumup"
version = "0.2.0"
authors = ["Urs Joss <[email protected]>"]
edition = "2021"
edition = "2024"
description = "A cli program to create LoLa specific exports from monthly SumUp reports"
license = "MIT"

Expand Down
7 changes: 4 additions & 3 deletions src/export/constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,10 @@ mod tests {
Ok(()) => assert!(expected_valid),
Err(e) => {
assert!(!expected_valid);
assert!(e
.to_string()
.starts_with("Row has an invalid Payment Method!"));
assert!(
e.to_string()
.starts_with("Row has an invalid Payment Method!")
);
}
}
Ok(())
Expand Down
10 changes: 8 additions & 2 deletions src/export/export_accounting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,17 @@ mod tests {
"10930/10100" => &[debt_to_miti],
)?;
match validate_acc_constraint(&df) {
Ok(()) => assert!(delta.is_none(), "Would not have expected delta {} on {date}.", delta.unwrap()),
Ok(()) => assert!(
delta.is_none(),
"Would not have expected delta {} on {date}.",
delta.unwrap()
),
Err(e) => match delta {
Some(d) => assert_eq!(
e.to_string(),
format!("Constraint violation for accounting export on {date}: net value of account {account} is {d} instead of 0.0")
format!(
"Constraint violation for accounting export on {date}: net value of account {account} is {d} instead of 0.0"
)
),
None => panic!("Would have expected delta on {date} but not in fixture: {e}"),
},
Expand Down
15 changes: 10 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ fn main() -> Result<(), Box<dyn Error>> {
}

pub fn configure_the_environment() {
env::set_var("POLARS_FMT_TABLE_ROUNDED_CORNERS", "1");
env::set_var("POLARS_FMT_MAX_COLS", "70");
env::set_var("POLARS_FMT_MAX_ROWS", "100");
env::set_var("POLARS_FMT_STR_LEN", "50");
unsafe {
env::set_var("POLARS_FMT_TABLE_ROUNDED_CORNERS", "1");
env::set_var("POLARS_FMT_MAX_COLS", "70");
env::set_var("POLARS_FMT_MAX_ROWS", "100");
env::set_var("POLARS_FMT_STR_LEN", "50");
};
}

/// Returns the current timestamp in format `<yyyymmddHHMMSS>`.
Expand Down Expand Up @@ -212,7 +214,10 @@ mod tests {
#[case(Some("intermediate_202303.csv"), "202303")]
#[case(Some("intermediate_202312_mod.csv"), "202312")]
#[case(None, "Unable to derive filename for intermediate file.")]
#[case(Some("intermediat_202303.csv"), "Filename 'intermediat_202303.csv' should have at least 23 characters (intermediate_yyyymm.csv), but has only 22.")]
#[case(
Some("intermediat_202303.csv"),
"Filename 'intermediat_202303.csv' should have at least 23 characters (intermediate_yyyymm.csv), but has only 22."
)]
#[case(
Some("abcdefghijkl_202303.csv"),
"Filename must start with 'intermediate_'."
Expand Down
4 changes: 2 additions & 2 deletions src/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use polars::frame::{DataFrame, UniqueKeepStrategy};
use polars::io::{SerReader, SerWriter};
use polars::prelude::LiteralValue::Null;
use polars::prelude::{
col, lit, when, CsvParseOptions, CsvReadOptions, CsvWriter, Expr, IntoLazy, JoinType,
NamedFromOwned, SortMultipleOptions, StrptimeOptions,
CsvParseOptions, CsvReadOptions, CsvWriter, Expr, IntoLazy, JoinType, NamedFromOwned,
SortMultipleOptions, StrptimeOptions, col, lit, when,
};
use polars::series::Series;
use serde::{Deserialize, Serialize};
Expand Down

0 comments on commit f9099f3

Please sign in to comment.