From 03956ffd88cf1bfeca5610fba3751a9a7bed7761 Mon Sep 17 00:00:00 2001 From: 35V LG84 <35vlg84-x4e6b92@e257.fi> Date: Sun, 9 Feb 2025 12:12:07 +0200 Subject: [PATCH] Rust-2024: use 2024 style Signed-off-by: 35V LG84 <35vlg84-x4e6b92@e257.fi> --- .github/workflows/ci.yml | 4 +++- justfile | 5 ++++- rustfmt.toml | 1 + tackler-api/src/filters/filter_definition.rs | 3 +-- .../src/filters/posting/posting_account.rs | 5 ++--- .../filters/posting/posting_amount_equal.rs | 7 +++---- .../filters/posting/posting_amount_greater.rs | 7 +++---- .../src/filters/posting/posting_amount_less.rs | 7 +++---- .../src/filters/posting/posting_comment.rs | 5 ++--- .../src/filters/posting/posting_commodity.rs | 5 ++--- .../src/filters/txn/txn_bbox_lat_lon.rs | 3 +-- .../src/filters/txn/txn_bbox_lat_lon_alt.rs | 3 +-- tackler-api/src/filters/txn/txn_code.rs | 5 ++--- tackler-api/src/filters/txn/txn_comments.rs | 5 ++--- tackler-api/src/filters/txn/txn_description.rs | 5 ++--- tackler-api/src/filters/txn/txn_tags.rs | 5 ++--- tackler-api/src/filters/txn/txn_ts_begin.rs | 5 ++--- tackler-api/src/filters/txn/txn_ts_end.rs | 5 ++--- tackler-api/src/filters/txn/txn_uuid.rs | 3 +-- tackler-api/src/metadata/items.rs | 2 +- tackler-api/src/txn_header.rs | 3 +-- tackler-api/src/txn_ts.rs | 3 +-- tackler-cli/build.rs | 7 +------ tackler-cli/src/cli_args.rs | 4 ++-- tackler-core/benches/parser_bench.rs | 3 +-- tackler-core/src/config/items.rs | 8 ++++++-- tackler-core/src/export/equity_exporter.rs | 2 +- tackler-core/src/filter.rs | 5 ++--- .../src/filter/posting/posting_account.rs | 3 +-- .../src/filter/posting/posting_amount_equal.rs | 3 +-- tackler-core/src/kernel/balance.rs | 2 +- tackler-core/src/kernel/price_lookup.rs | 2 +- .../src/kernel/report_item_selector.rs | 3 +-- tackler-core/src/kernel/report_settings.rs | 2 +- tackler-core/src/kernel/settings.rs | 18 +++++++++++------- tackler-core/src/model/register.rs | 6 +++--- tackler-core/src/model/transaction.rs | 3 +-- tackler-core/src/model/txn_data.rs | 11 +++++++---- tackler-core/src/parser.rs | 3 +-- tackler-core/src/parser/parts/comment.rs | 3 +-- tackler-core/src/parser/parts/number.rs | 3 +-- tackler-core/src/parser/parts/posting_value.rs | 5 ++--- tackler-core/src/parser/parts/pricedb.rs | 6 +++--- tackler-core/src/parser/parts/timestamp.rs | 7 +++---- tackler-core/src/parser/parts/txn_comment.rs | 5 ++--- tackler-core/src/parser/parts/txn_header.rs | 7 +++---- .../src/parser/parts/txn_header_code.rs | 3 +-- .../src/parser/parts/txn_meta_location.rs | 5 ++--- tackler-core/src/parser/parts/txn_meta_tags.rs | 5 ++--- tackler-core/src/parser/parts/txn_meta_uuid.rs | 7 +++---- tackler-core/src/parser/parts/txn_metadata.rs | 5 ++--- tackler-core/src/parser/parts/txn_posting.rs | 7 +++---- tackler-core/src/parser/parts/txn_postings.rs | 5 ++--- tackler-core/src/parser/parts/txns.rs | 11 +++++++---- tackler-core/src/parser/pricedb_parser.rs | 3 +-- tackler-core/src/parser/tackler_parser.rs | 3 +-- .../src/report/balance_group_reporter.rs | 6 +++--- tackler-core/src/report/balance_reporter.rs | 2 +- tackler-core/src/report/register_reporter.rs | 6 +++--- .../src/regex/serde/full_haystack_matcher.rs | 3 +-- 60 files changed, 131 insertions(+), 157 deletions(-) create mode 100644 rustfmt.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 947b1c2..dd1dfa4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,11 @@ jobs: - uses: actions/checkout@v4 with: submodules: 'true' + - run: rustup toolchain install nightly-x86_64-unknown-linux-gnu + - run: rustup component add --toolchain nightly-x86_64-unknown-linux-gnu rustfmt - run: rustup show - uses: Swatinem/rust-cache@v2 - - run: cargo fmt --all --check + - run: cargo +nightly fmt --all --check -- --style-edition 2024 clippy: runs-on: ubuntu-latest diff --git a/justfile b/justfile index 0a79327..e5c54f2 100644 --- a/justfile +++ b/justfile @@ -20,7 +20,10 @@ clean: check: cargo clippy --workspace --all-targets --no-deps -- -D warnings - cargo fmt --all --check + cargo +nightly fmt --all --check -- --style-edition 2024 + +fmt: + cargo +nightly fmt --all -- --style-edition 2024 test: (_test "debug") diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..3501136 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +style_edition = "2024" diff --git a/tackler-api/src/filters/filter_definition.rs b/tackler-api/src/filters/filter_definition.rs index 488daaf..ff9fe87 100644 --- a/tackler-api/src/filters/filter_definition.rs +++ b/tackler-api/src/filters/filter_definition.rs @@ -1,12 +1,11 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ use crate::filters::IndentDisplay; use crate::filters::TxnFilter; -use base64::{engine::general_purpose, Engine as _}; +use base64::{Engine as _, engine::general_purpose}; use jiff::tz::TimeZone; use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; diff --git a/tackler-api/src/filters/posting/posting_account.rs b/tackler-api/src/filters/posting/posting_account.rs index 053288b..7adaa8f 100644 --- a/tackler-api/src/filters/posting/posting_account.rs +++ b/tackler-api/src/filters/posting/posting_account.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -36,12 +35,12 @@ impl IndentDisplay for TxnFilterPostingAccount { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: fdb5c728-1354-4905-8bc0-42c17cc6d948 diff --git a/tackler-api/src/filters/posting/posting_amount_equal.rs b/tackler-api/src/filters/posting/posting_amount_equal.rs index 17880f9..04a4308 100644 --- a/tackler-api/src/filters/posting/posting_amount_equal.rs +++ b/tackler-api/src/filters/posting/posting_amount_equal.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,7 +11,7 @@ use std::fmt::Formatter; use tackler_rs::regex::peeled_pattern; use tackler_rs::regex::serde::full_haystack_matcher; -use crate::filters::{posting_filter_indent_fmt, IndentDisplay}; +use crate::filters::{IndentDisplay, posting_filter_indent_fmt}; /// Txn Posting "Amount is equal" filter /// @@ -48,12 +47,12 @@ impl IndentDisplay for TxnFilterPostingAmountEqual { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: c63d9ff7-6039-474b-8b8a-be6b8927510f diff --git a/tackler-api/src/filters/posting/posting_amount_greater.rs b/tackler-api/src/filters/posting/posting_amount_greater.rs index 0fcbb80..f260756 100644 --- a/tackler-api/src/filters/posting/posting_amount_greater.rs +++ b/tackler-api/src/filters/posting/posting_amount_greater.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,7 +11,7 @@ use std::fmt::Formatter; use tackler_rs::regex::peeled_pattern; use tackler_rs::regex::serde::full_haystack_matcher; -use crate::filters::{posting_filter_indent_fmt, IndentDisplay}; +use crate::filters::{IndentDisplay, posting_filter_indent_fmt}; /// Txn Posting "Amount is Greater than" filter /// @@ -54,12 +53,12 @@ impl IndentDisplay for TxnFilterPostingAmountGreater { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: 8609eb58-f600-42d1-a20a-c7de2c57e6e2 diff --git a/tackler-api/src/filters/posting/posting_amount_less.rs b/tackler-api/src/filters/posting/posting_amount_less.rs index 2aeb99a..166b086 100644 --- a/tackler-api/src/filters/posting/posting_amount_less.rs +++ b/tackler-api/src/filters/posting/posting_amount_less.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -12,7 +11,7 @@ use std::fmt::Formatter; use tackler_rs::regex::peeled_pattern; use tackler_rs::regex::serde::full_haystack_matcher; -use crate::filters::{posting_filter_indent_fmt, IndentDisplay}; +use crate::filters::{IndentDisplay, posting_filter_indent_fmt}; /// Txn Posting "Amount is Less than" filter /// @@ -54,12 +53,12 @@ impl IndentDisplay for TxnFilterPostingAmountLess { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: 2d01669b-b051-4550-9436-ac31e84dd892 diff --git a/tackler-api/src/filters/posting/posting_comment.rs b/tackler-api/src/filters/posting/posting_comment.rs index 1731bb8..d6496b6 100644 --- a/tackler-api/src/filters/posting/posting_comment.rs +++ b/tackler-api/src/filters/posting/posting_comment.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -37,12 +36,12 @@ impl IndentDisplay for TxnFilterPostingComment { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: df851a3a-80b8-49ca-9dfa-f7b5ce122ddf diff --git a/tackler-api/src/filters/posting/posting_commodity.rs b/tackler-api/src/filters/posting/posting_commodity.rs index 13dfeb3..c27f34a 100644 --- a/tackler-api/src/filters/posting/posting_commodity.rs +++ b/tackler-api/src/filters/posting/posting_commodity.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -37,12 +36,12 @@ impl IndentDisplay for TxnFilterPostingCommodity { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: d2fbabba-f37c-4245-bf7a-0fed4db82695 diff --git a/tackler-api/src/filters/txn/txn_bbox_lat_lon.rs b/tackler-api/src/filters/txn/txn_bbox_lat_lon.rs index a0f1cd8..a3d660c 100644 --- a/tackler-api/src/filters/txn/txn_bbox_lat_lon.rs +++ b/tackler-api/src/filters/txn/txn_bbox_lat_lon.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -45,7 +44,7 @@ impl IndentDisplay for TxnFilterBBoxLatLon { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; diff --git a/tackler-api/src/filters/txn/txn_bbox_lat_lon_alt.rs b/tackler-api/src/filters/txn/txn_bbox_lat_lon_alt.rs index 4af4192..f2ae378 100644 --- a/tackler-api/src/filters/txn/txn_bbox_lat_lon_alt.rs +++ b/tackler-api/src/filters/txn/txn_bbox_lat_lon_alt.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -51,7 +50,7 @@ impl IndentDisplay for TxnFilterBBoxLatLonAlt { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; diff --git a/tackler-api/src/filters/txn/txn_code.rs b/tackler-api/src/filters/txn/txn_code.rs index f226330..31e606f 100644 --- a/tackler-api/src/filters/txn/txn_code.rs +++ b/tackler-api/src/filters/txn/txn_code.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -33,12 +32,12 @@ impl IndentDisplay for TxnFilterTxnCode { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: 2e005db0-f3f5-4ef4-a574-ed3371d4f5c9 diff --git a/tackler-api/src/filters/txn/txn_comments.rs b/tackler-api/src/filters/txn/txn_comments.rs index 068a283..eb337cc 100644 --- a/tackler-api/src/filters/txn/txn_comments.rs +++ b/tackler-api/src/filters/txn/txn_comments.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -37,12 +36,12 @@ impl IndentDisplay for TxnFilterTxnComments { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: 3debf0d5-599f-41a2-9d5f-e16a54cb1e3e diff --git a/tackler-api/src/filters/txn/txn_description.rs b/tackler-api/src/filters/txn/txn_description.rs index dd8f14d..347fca1 100644 --- a/tackler-api/src/filters/txn/txn_description.rs +++ b/tackler-api/src/filters/txn/txn_description.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -37,12 +36,12 @@ impl IndentDisplay for TxnFilterTxnDescription { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: f2a52f9d-1fd6-428d-9bb4-7821d1f15ce3 diff --git a/tackler-api/src/filters/txn/txn_tags.rs b/tackler-api/src/filters/txn/txn_tags.rs index d0b792b..6283a10 100644 --- a/tackler-api/src/filters/txn/txn_tags.rs +++ b/tackler-api/src/filters/txn/txn_tags.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -33,12 +32,12 @@ impl IndentDisplay for TxnFilterTxnTags { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; - use tackler_rs::regex::new_full_haystack_regex; use tackler_rs::IndocUtils; + use tackler_rs::regex::new_full_haystack_regex; #[test] // test: d2aa8d62-97cb-49e1-ac7b-f81a1a511b6b diff --git a/tackler-api/src/filters/txn/txn_ts_begin.rs b/tackler-api/src/filters/txn/txn_ts_begin.rs index 9d3725b..ce023a0 100644 --- a/tackler-api/src/filters/txn/txn_ts_begin.rs +++ b/tackler-api/src/filters/txn/txn_ts_begin.rs @@ -1,13 +1,12 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ use crate::filters::IndentDisplay; use crate::txn_ts::rfc_3339; -use jiff::tz::TimeZone; use jiff::Timestamp; +use jiff::tz::TimeZone; use serde::{Deserialize, Serialize}; use std::fmt::Formatter; @@ -41,7 +40,7 @@ impl IndentDisplay for TxnFilterTxnTSBegin { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; diff --git a/tackler-api/src/filters/txn/txn_ts_end.rs b/tackler-api/src/filters/txn/txn_ts_end.rs index 8613138..e3d02d1 100644 --- a/tackler-api/src/filters/txn/txn_ts_end.rs +++ b/tackler-api/src/filters/txn/txn_ts_end.rs @@ -1,13 +1,12 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ use crate::filters::IndentDisplay; use crate::txn_ts::rfc_3339; -use jiff::tz::TimeZone; use jiff::Timestamp; +use jiff::tz::TimeZone; use serde::{Deserialize, Serialize}; use std::fmt::Formatter; @@ -41,7 +40,7 @@ impl IndentDisplay for TxnFilterTxnTSEnd { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; diff --git a/tackler-api/src/filters/txn/txn_uuid.rs b/tackler-api/src/filters/txn/txn_uuid.rs index 4467089..500e391 100644 --- a/tackler-api/src/filters/txn/txn_uuid.rs +++ b/tackler-api/src/filters/txn/txn_uuid.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -30,7 +29,7 @@ impl IndentDisplay for TxnFilterTxnUUID { mod tests { use super::*; use crate::filters::{ - logic::TxnFilterAND, FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, + FilterDefZoned, FilterDefinition, NullaryTRUE, TxnFilter, logic::TxnFilterAND, }; use indoc::indoc; use jiff::tz; diff --git a/tackler-api/src/metadata/items.rs b/tackler-api/src/metadata/items.rs index a425c96..fcb4a35 100644 --- a/tackler-api/src/metadata/items.rs +++ b/tackler-api/src/metadata/items.rs @@ -9,8 +9,8 @@ use crate::filters::{FilterDefZoned, FilterDefinition}; use crate::metadata::Checksum; use crate::txn_ts; -use jiff::tz::TimeZone; use jiff::Zoned; +use jiff::tz::TimeZone; #[doc(hidden)] pub type MetadataItems = Vec; diff --git a/tackler-api/src/txn_header.rs b/tackler-api/src/txn_header.rs index 31fa380..99e8907 100644 --- a/tackler-api/src/txn_header.rs +++ b/tackler-api/src/txn_header.rs @@ -1,13 +1,12 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ //! Transaction header //! -use jiff::tz::TimeZone; use jiff::Zoned; +use jiff::tz::TimeZone; use std::cmp::Ordering; use std::fmt::Write; use std::sync::Arc; diff --git a/tackler-api/src/txn_ts.rs b/tackler-api/src/txn_ts.rs index ed8e172..092252e 100644 --- a/tackler-api/src/txn_ts.rs +++ b/tackler-api/src/txn_ts.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -9,9 +8,9 @@ //! `txn_ts` is collection of utilities to generate //! different representations of Txn timestamps. //! +use jiff::Zoned; use jiff::fmt::strtime; use jiff::tz::{Offset, TimeZone}; -use jiff::Zoned; use std::error::Error; /// UTC Timezone diff --git a/tackler-cli/build.rs b/tackler-cli/build.rs index 8395f2e..4061fb3 100644 --- a/tackler-cli/build.rs +++ b/tackler-cli/build.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2022-2024 - * * SPDX-License-Identifier: Apache-2.0 */ use std::env; @@ -26,11 +25,7 @@ fn git_version() -> Option { .and_then(|output| String::from_utf8(output.stdout).ok()) .and_then(|tag| { let t = tag.trim(); - if t.is_empty() { - None - } else { - Some(t.into()) - } + if t.is_empty() { None } else { Some(t.into()) } }); let commit_id: Option = Command::new("git") diff --git a/tackler-cli/src/cli_args.rs b/tackler-cli/src/cli_args.rs index 5c10090..b65c756 100644 --- a/tackler-cli/src/cli_args.rs +++ b/tackler-cli/src/cli_args.rs @@ -9,12 +9,12 @@ use std::error::Error; use std::path::PathBuf; use tackler_api::txn_ts; use tackler_core::config; +use tackler_core::config::PriceLookupType; use tackler_core::config::overlaps::{ AuditOverlap, OverlapConfig, PriceOverlap, ReportOverlap, StrictOverlap, }; -use tackler_core::config::PriceLookupType; -use tackler_core::kernel::settings::{FileInput, FsInput, GitInput, InputSettings}; use tackler_core::kernel::Settings; +use tackler_core::kernel::settings::{FileInput, FsInput, GitInput, InputSettings}; use tackler_core::parser::GitInputSelector; pub(crate) const PRICE_BEFORE: &str = "price.before"; diff --git a/tackler-core/benches/parser_bench.rs b/tackler-core/benches/parser_bench.rs index 1d337e4..3b61fdf 100644 --- a/tackler-core/benches/parser_bench.rs +++ b/tackler-core/benches/parser_bench.rs @@ -1,10 +1,9 @@ /* * Tackler-NG 2025 - * * SPDX-License-Identifier: Apache-2.0 */ -use criterion::{criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, criterion_group, criterion_main}; use indoc::indoc; use tackler_core::kernel::Settings; use tackler_core::parser::string_to_txns; diff --git a/tackler-core/src/config/items.rs b/tackler-core/src/config/items.rs index 7eadf39..8e71570 100644 --- a/tackler-core/src/config/items.rs +++ b/tackler-core/src/config/items.rs @@ -378,7 +378,9 @@ impl Accounts { let acc_raw: AccountsRaw = match fs::read_to_string(&accs_path) { Ok(s) => toml::from_str(s.as_str())?, Err(err) => { - let msg = format!("Accounts configuration error while reading file '{accs_path_str}': {err}"); + let msg = format!( + "Accounts configuration error while reading file '{accs_path_str}': {err}" + ); return Err(msg.into()); } }; @@ -412,7 +414,9 @@ impl Commodities { let comm_raw: CommoditiesRaw = match fs::read_to_string(&comm_path) { Ok(s) => toml::from_str(s.as_str())?, Err(err) => { - let msg = format!("Commodities configuration error while reading file '{comm_path_str}': {err}"); + let msg = format!( + "Commodities configuration error while reading file '{comm_path_str}': {err}" + ); return Err(msg.into()); } }; diff --git a/tackler-core/src/export/equity_exporter.rs b/tackler-core/src/export/equity_exporter.rs index d6e0772..6c65a61 100644 --- a/tackler-core/src/export/equity_exporter.rs +++ b/tackler-core/src/export/equity_exporter.rs @@ -4,12 +4,12 @@ */ use crate::export::Export; +use crate::kernel::Settings; use crate::kernel::balance::Balance; use crate::kernel::price_lookup::PriceLookupCtx; use crate::kernel::report_item_selector::{ BalanceNonZeroByAccountSelector, BalanceNonZeroSelector, BalanceSelector, }; -use crate::kernel::Settings; use crate::model::{Transaction, TxnSet}; use itertools::Itertools; use rust_decimal::Decimal; diff --git a/tackler-core/src/filter.rs b/tackler-core/src/filter.rs index bdefed6..8e3d2f4 100644 --- a/tackler-core/src/filter.rs +++ b/tackler-core/src/filter.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -62,8 +61,8 @@ mod tests { use rust_decimal::Decimal; use std::sync::Arc; use tackler_api::filters::{ - logic::TxnFilterAND, logic::TxnFilterNOT, logic::TxnFilterOR, NullaryFALSE, NullaryTRUE, - TxnFilter, + NullaryFALSE, NullaryTRUE, TxnFilter, logic::TxnFilterAND, logic::TxnFilterNOT, + logic::TxnFilterOR, }; use tackler_api::location::GeoPoint; use tackler_api::txn_header::TxnHeader; diff --git a/tackler-core/src/filter/posting/posting_account.rs b/tackler-core/src/filter/posting/posting_account.rs index 709ebe1..cb2c585 100644 --- a/tackler-core/src/filter/posting/posting_account.rs +++ b/tackler-core/src/filter/posting/posting_account.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -25,7 +24,7 @@ mod tests { use crate::filter::tests::make_posts_txn; use crate::model::Transaction; use regex::Regex; - use tackler_api::filters::{posting::TxnFilterPostingAccount, TxnFilter}; + use tackler_api::filters::{TxnFilter, posting::TxnFilterPostingAccount}; #[test] // test: 7784049f-ef3e-4185-8d33-f8c78478eef1 diff --git a/tackler-core/src/filter/posting/posting_amount_equal.rs b/tackler-core/src/filter/posting/posting_amount_equal.rs index 753f88a..520ea5c 100644 --- a/tackler-core/src/filter/posting/posting_amount_equal.rs +++ b/tackler-core/src/filter/posting/posting_amount_equal.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -25,7 +24,7 @@ mod tests { use crate::model::Transaction; use regex::Regex; use rust_decimal::Decimal; - use tackler_api::filters::{posting::TxnFilterPostingAmountEqual, TxnFilter}; + use tackler_api::filters::{TxnFilter, posting::TxnFilterPostingAmountEqual}; #[test] // test: de72fb67-14a7-4032-b2c2-b1049ecd0c35 diff --git a/tackler-core/src/kernel/balance.rs b/tackler-core/src/kernel/balance.rs index 7a36366..8a34bca 100644 --- a/tackler-core/src/kernel/balance.rs +++ b/tackler-core/src/kernel/balance.rs @@ -3,9 +3,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +use crate::kernel::Settings; use crate::kernel::price_lookup::PriceLookupCtx; use crate::kernel::report_item_selector::BalanceSelector; -use crate::kernel::Settings; use crate::model::balance_tree_node::ord_by_btn; use crate::model::{BalanceTreeNode, Commodity, Transaction, TxnAccount, TxnSet}; use itertools::Itertools; diff --git a/tackler-core/src/kernel/price_lookup.rs b/tackler-core/src/kernel/price_lookup.rs index 2d68a2d..cad92c9 100644 --- a/tackler-core/src/kernel/price_lookup.rs +++ b/tackler-core/src/kernel/price_lookup.rs @@ -4,8 +4,8 @@ */ use crate::model::{ - price_entry::{PriceDb, PriceEntry}, Commodity, Transaction, TxnAccount, TxnRefs, + price_entry::{PriceDb, PriceEntry}, }; use itertools::Itertools; use jiff::tz::TimeZone; diff --git a/tackler-core/src/kernel/report_item_selector.rs b/tackler-core/src/kernel/report_item_selector.rs index 09d954c..1fb31c9 100644 --- a/tackler-core/src/kernel/report_item_selector.rs +++ b/tackler-core/src/kernel/report_item_selector.rs @@ -1,11 +1,10 @@ /* * Tackler-NG 2023 - * * SPDX-License-Identifier: Apache-2.0 */ -use crate::kernel::hash::Hash; use crate::kernel::Predicate; +use crate::kernel::hash::Hash; use crate::model::{BalanceTreeNode, RegisterPosting}; use regex::RegexSet; use std::error::Error; diff --git a/tackler-core/src/kernel/report_settings.rs b/tackler-core/src/kernel/report_settings.rs index 4536d7e..edb021a 100644 --- a/tackler-core/src/kernel/report_settings.rs +++ b/tackler-core/src/kernel/report_settings.rs @@ -3,8 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ use crate::config::Scale; -use crate::kernel::price_lookup::PriceLookup; use crate::kernel::Settings; +use crate::kernel::price_lookup::PriceLookup; use crate::model::Commodity; use jiff::tz::TimeZone; use std::error::Error; diff --git a/tackler-core/src/kernel/settings.rs b/tackler-core/src/kernel/settings.rs index 0fbd61d..92f1a34 100644 --- a/tackler-core/src/kernel/settings.rs +++ b/tackler-core/src/kernel/settings.rs @@ -8,8 +8,8 @@ use crate::config::{ }; use crate::kernel::hash::Hash; use crate::kernel::price_lookup::PriceLookup; -use crate::model::price_entry::PriceDb; use crate::model::TxnAccount; +use crate::model::price_entry::PriceDb; use crate::model::{AccountTreeNode, Commodity}; use crate::parser::GitInputSelector; use crate::{config, parser}; @@ -706,9 +706,11 @@ mod tests { assert_eq!(txntn_2.atn.get_name(), "c"); // Check that it won't create a synthetic account as real one - assert!(settings - .get_or_create_txn_account("a:b", comm.clone()) - .is_err()); + assert!( + settings + .get_or_create_txn_account("a:b", comm.clone()) + .is_err() + ); assert_eq!(settings.accounts.defined_accounts.len(), 1); assert_eq!(settings.accounts.synthetic_parents.len(), 2); @@ -778,9 +780,11 @@ mod tests { assert_eq!(settings.accounts.synthetic_parents.len(), 1); // Check that it won't create a synthetic account as real one - assert!(settings - .get_or_create_txn_account("a:b:c", comm.clone()) - .is_err()); + assert!( + settings + .get_or_create_txn_account("a:b:c", comm.clone()) + .is_err() + ); let txntn_synth = settings.get_txn_account("a:b:c", comm.clone()).unwrap(/*:test:*/); assert_eq!(settings.accounts.defined_accounts.len(), 3); diff --git a/tackler-core/src/model/register.rs b/tackler-core/src/model/register.rs index 7c9995a..c11769a 100644 --- a/tackler-core/src/model/register.rs +++ b/tackler-core/src/model/register.rs @@ -4,13 +4,13 @@ */ use crate::config::Scale; -use crate::kernel::price_lookup::PriceLookup; use crate::kernel::RegisterSettings; +use crate::kernel::price_lookup::PriceLookup; use crate::model::{Commodity, Posting, Transaction}; -use jiff::tz::TimeZone; use jiff::Zoned; +use jiff::tz::TimeZone; use rust_decimal::{Decimal, RoundingStrategy}; -use std::cmp::{max, Ordering}; +use std::cmp::{Ordering, max}; use std::fmt::Write; use std::fmt::{Display, Formatter}; use std::sync::Arc; diff --git a/tackler-core/src/model/transaction.rs b/tackler-core/src/model/transaction.rs index b905f58..a999bbb 100644 --- a/tackler-core/src/model/transaction.rs +++ b/tackler-core/src/model/transaction.rs @@ -1,10 +1,9 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ -use crate::model::{posting, Posts}; +use crate::model::{Posts, posting}; use jiff::tz; use std::cmp::Ordering; use std::error::Error; diff --git a/tackler-core/src/model/txn_data.rs b/tackler-core/src/model/txn_data.rs index c7ee427..9317906 100644 --- a/tackler-core/src/model/txn_data.rs +++ b/tackler-core/src/model/txn_data.rs @@ -1,15 +1,14 @@ /* * Tackler-NG 2023-2024 - * * SPDX-License-Identifier: Apache-2.0 */ use itertools::Itertools; use std::error::Error; -use crate::kernel::hash::Hash; use crate::kernel::Predicate; -use crate::model::{transaction, TxnRefs, Txns}; +use crate::kernel::hash::Hash; +use crate::model::{TxnRefs, Txns, transaction}; use tackler_api::filters::FilterDefinition; use tackler_api::metadata::items::{MetadataItem, TxnFilterDescription, TxnSetChecksum}; use tackler_api::metadata::{Checksum, Metadata}; @@ -126,7 +125,11 @@ fn calc_txn_checksum(txns: &TxnRefs<'_>, hasher: &Hash) -> Result(is: &mut Stream<'s>) -> PResult<&'s str> { let m = seq!( diff --git a/tackler-core/src/parser/parts/number.rs b/tackler-core/src/parser/parts/number.rs index ff51b5e..69049b3 100644 --- a/tackler-core/src/parser/parts/number.rs +++ b/tackler-core/src/parser/parts/number.rs @@ -1,10 +1,9 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ -use crate::parser::{make_semantic_error, Stream}; +use crate::parser::{Stream, make_semantic_error}; use rust_decimal::Decimal; use winnow::combinator::{opt, preceded}; use winnow::stream::AsChar; diff --git a/tackler-core/src/parser/parts/posting_value.rs b/tackler-core/src/parser/parts/posting_value.rs index 7d11a2d..22d2bb8 100644 --- a/tackler-core/src/parser/parts/posting_value.rs +++ b/tackler-core/src/parser/parts/posting_value.rs @@ -1,19 +1,18 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ use crate::kernel::Settings; use crate::model::Commodity; use crate::parser::parts::identifier::p_identifier; use crate::parser::parts::number::p_number; -use crate::parser::{from_error, Stream}; +use crate::parser::{Stream, from_error}; use rust_decimal::Decimal; use std::error::Error; use std::sync::Arc; use winnow::ascii::{space0, space1}; use winnow::combinator::{alt, opt}; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; /* // The old ANTLR Grammar diff --git a/tackler-core/src/parser/parts/pricedb.rs b/tackler-core/src/parser/parts/pricedb.rs index e3e0125..dd22b6c 100644 --- a/tackler-core/src/parser/parts/pricedb.rs +++ b/tackler-core/src/parser/parts/pricedb.rs @@ -1,18 +1,18 @@ /* * Tackler-NG 2025 - * * SPDX-License-Identifier: Apache-2.0 */ use winnow::{ + PResult, Parser, ascii::{line_ending, space0, space1}, combinator::opt, error::{StrContext, StrContextValue}, - seq, PResult, Parser, + seq, }; use crate::model::price_entry::PriceEntry; -use crate::parser::{from_error, parts::timestamp::parse_timestamp, Stream}; +use crate::parser::{Stream, from_error, parts::timestamp::parse_timestamp}; use super::{comment::p_comment, identifier::p_identifier, number::p_number}; diff --git a/tackler-core/src/parser/parts/timestamp.rs b/tackler-core/src/parser/parts/timestamp.rs index 0416f00..1f9d14a 100644 --- a/tackler-core/src/parser/parts/timestamp.rs +++ b/tackler-core/src/parser/parts/timestamp.rs @@ -1,12 +1,11 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ use std::error::Error; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; -use crate::parser::{from_error, Stream}; +use crate::parser::{Stream, from_error}; use std::str::FromStr; use winnow::combinator::{alt, cut_err, fail, opt}; use winnow::error::{StrContext, StrContextValue}; @@ -97,7 +96,7 @@ fn p_datetime(is: &mut Stream<'_>) -> PResult { ) .parse_next(is)?; - let time = match handle_time(h, m, s, ns_opt.map(|x| x.0 .1)) { + let time = match handle_time(h, m, s, ns_opt.map(|x| x.0.1)) { Ok(t) => t, Err(err) => return Err(from_error(is, err.as_ref())), }; diff --git a/tackler-core/src/parser/parts/txn_comment.rs b/tackler-core/src/parser/parts/txn_comment.rs index 0e4c361..514a269 100644 --- a/tackler-core/src/parser/parts/txn_comment.rs +++ b/tackler-core/src/parser/parts/txn_comment.rs @@ -1,13 +1,12 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ -use crate::parser::parts::comment::p_comment; use crate::parser::Stream; +use crate::parser::parts::comment::p_comment; use winnow::ascii::{line_ending, space1}; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; pub(crate) fn parse_txn_comment<'s>(is: &mut Stream<'s>) -> PResult<&'s str> { let m = seq!( diff --git a/tackler-core/src/parser/parts/txn_header.rs b/tackler-core/src/parser/parts/txn_header.rs index 95b5df6..adc5d21 100644 --- a/tackler-core/src/parser/parts/txn_header.rs +++ b/tackler-core/src/parser/parts/txn_header.rs @@ -1,18 +1,17 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ use std::fmt::Write; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; use crate::parser::parts::timestamp::parse_timestamp; use crate::parser::parts::txn_comment::parse_txn_comment; use crate::parser::parts::txn_header_code::parse_txn_code; use crate::parser::parts::txn_header_desc::parse_txn_description; -use crate::parser::parts::txn_metadata::{parse_txn_meta, TxnMeta}; -use crate::parser::{make_semantic_error, Stream}; +use crate::parser::parts::txn_metadata::{TxnMeta, parse_txn_meta}; +use crate::parser::{Stream, make_semantic_error}; use tackler_api::txn_header::TxnHeader; use winnow::ascii::{line_ending, space1}; use winnow::combinator::{cut_err, opt, preceded, repeat}; diff --git a/tackler-core/src/parser/parts/txn_header_code.rs b/tackler-core/src/parser/parts/txn_header_code.rs index 83f2eb6..5139978 100644 --- a/tackler-core/src/parser/parts/txn_header_code.rs +++ b/tackler-core/src/parser/parts/txn_header_code.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,7 +7,7 @@ use crate::parser::Stream; use winnow::combinator::cut_err; use winnow::error::StrContext; use winnow::token::take_while; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; fn valid_code_char(c: char) -> bool { !matches!( diff --git a/tackler-core/src/parser/parts/txn_meta_location.rs b/tackler-core/src/parser/parts/txn_meta_location.rs index d7df557..aa159ad 100644 --- a/tackler-core/src/parser/parts/txn_meta_location.rs +++ b/tackler-core/src/parser/parts/txn_meta_location.rs @@ -1,16 +1,15 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ use crate::parser::parts::number::p_number; -use crate::parser::{from_error, Stream}; +use crate::parser::{Stream, from_error}; use tackler_api::location::GeoPoint; use winnow::ascii::{line_ending, space0, space1}; use winnow::combinator::{cut_err, opt, preceded}; use winnow::error::{StrContext, StrContextValue}; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; const CTX_LABEL: &str = "txn metadata location"; diff --git a/tackler-core/src/parser/parts/txn_meta_tags.rs b/tackler-core/src/parser/parts/txn_meta_tags.rs index 84454ae..e4a1f6c 100644 --- a/tackler-core/src/parser/parts/txn_meta_tags.rs +++ b/tackler-core/src/parser/parts/txn_meta_tags.rs @@ -1,18 +1,17 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ use crate::kernel::Settings; use crate::parser::parts::identifier::p_multi_part_id; -use crate::parser::{from_error, Stream}; +use crate::parser::{Stream, from_error}; use itertools::Itertools; use std::error::Error; use tackler_api::txn_header::Tags; use winnow::ascii::{line_ending, space0, space1}; use winnow::combinator::{cut_err, repeat}; use winnow::error::{StrContext, StrContextValue}; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; const CTX_LABEL: &str = "txn metadata tags"; diff --git a/tackler-core/src/parser/parts/txn_meta_uuid.rs b/tackler-core/src/parser/parts/txn_meta_uuid.rs index e1cb417..d269e67 100644 --- a/tackler-core/src/parser/parts/txn_meta_uuid.rs +++ b/tackler-core/src/parser/parts/txn_meta_uuid.rs @@ -1,18 +1,17 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ -use crate::parser::{make_semantic_error, Stream}; +use crate::parser::{Stream, make_semantic_error}; use uuid::Uuid; +use winnow::Parser; use winnow::ascii::{line_ending, space0, space1}; use winnow::combinator::cut_err; use winnow::error::{StrContext, StrContextValue}; use winnow::stream::AsChar; use winnow::token::take_while; -use winnow::Parser; -use winnow::{seq, PResult}; +use winnow::{PResult, seq}; const CTX_LABEL: &str = "txn metadata uuid"; const UUID_HELP: &str = " # uuid: d77b6b92-42f1-419d-834c-66d69f155ad6"; diff --git a/tackler-core/src/parser/parts/txn_metadata.rs b/tackler-core/src/parser/parts/txn_metadata.rs index b24e601..5911acc 100644 --- a/tackler-core/src/parser/parts/txn_metadata.rs +++ b/tackler-core/src/parser/parts/txn_metadata.rs @@ -1,18 +1,17 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ +use crate::parser::Stream; use crate::parser::parts::txn_meta_location::parse_meta_location; use crate::parser::parts::txn_meta_tags::parse_meta_tags; use crate::parser::parts::txn_meta_uuid::parse_meta_uuid; -use crate::parser::Stream; use tackler_api::location::GeoPoint; use tackler_api::txn_header::Tags; use uuid::Uuid; use winnow::combinator::{alt, opt}; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; pub(crate) struct TxnMeta { pub(crate) uuid: Option, diff --git a/tackler-core/src/parser/parts/txn_posting.rs b/tackler-core/src/parser/parts/txn_posting.rs index 227541e..8b27714 100644 --- a/tackler-core/src/parser/parts/txn_posting.rs +++ b/tackler-core/src/parser/parts/txn_posting.rs @@ -1,18 +1,17 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ use crate::kernel::Settings; use crate::model::Posting; use crate::parser::parts::comment::p_comment; use crate::parser::parts::identifier::p_multi_part_id; -use crate::parser::parts::posting_value::{parse_posting_value, ValuePosition}; -use crate::parser::{from_error, Stream}; +use crate::parser::parts::posting_value::{ValuePosition, parse_posting_value}; +use crate::parser::{Stream, from_error}; use std::error::Error; use winnow::ascii::{line_ending, space0, space1}; use winnow::combinator::opt; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; /* // The old ANTLR Grammar diff --git a/tackler-core/src/parser/parts/txn_postings.rs b/tackler-core/src/parser/parts/txn_postings.rs index e8ccd1d..43a1f08 100644 --- a/tackler-core/src/parser/parts/txn_postings.rs +++ b/tackler-core/src/parser/parts/txn_postings.rs @@ -1,15 +1,14 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ use crate::model::posting::txn_sum; use crate::model::{Posting, Posts}; use crate::parser::parts::txn_posting::{parse_txn_last_posting, parse_txn_posting}; -use crate::parser::{from_error, Stream}; +use crate::parser::{Stream, from_error}; use std::ops::Neg; use winnow::combinator::{opt, repeat}; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; pub(crate) fn parse_txn_postings(is: &mut Stream<'_>) -> PResult { let mut postings = seq!( diff --git a/tackler-core/src/parser/parts/txns.rs b/tackler-core/src/parser/parts/txns.rs index 36fa0a1..4518332 100644 --- a/tackler-core/src/parser/parts/txns.rs +++ b/tackler-core/src/parser/parts/txns.rs @@ -1,15 +1,14 @@ /* * Tackler-NG 2024-2025 - * * SPDX-License-Identifier: Apache-2.0 */ use itertools::Itertools; -use winnow::{seq, PResult, Parser}; +use winnow::{PResult, Parser, seq}; use crate::model::{Transaction, Txns}; use crate::parser::parts::txn_header::parse_txn_header; use crate::parser::parts::txn_postings::parse_txn_postings; -use crate::parser::{from_error, make_semantic_error, Stream}; +use crate::parser::{Stream, from_error, make_semantic_error}; use winnow::ascii::{line_ending, multispace0, space0}; use winnow::combinator::{cut_err, eof, opt, preceded, repeat, repeat_till}; use winnow::error::StrContext; @@ -36,7 +35,11 @@ fn parse_txn(is: &mut Stream<'_>) -> PResult { if txn.1.iter().map(|p| &p.txn_commodity.name).unique().count() > 1 { let msg = format!( "Different commodities without value positions are not allowed inside single transaction.{}", - txn.0.uuid.map(|u| format!("\n txn uuid: {u}")).unwrap_or_default()); + txn.0 + .uuid + .map(|u| format!("\n txn uuid: {u}")) + .unwrap_or_default() + ); return Err(make_semantic_error(is, msg.as_str())); } diff --git a/tackler-core/src/parser/pricedb_parser.rs b/tackler-core/src/parser/pricedb_parser.rs index b09e41c..244fb61 100644 --- a/tackler-core/src/parser/pricedb_parser.rs +++ b/tackler-core/src/parser/pricedb_parser.rs @@ -1,13 +1,12 @@ /* * Tackler-NG 2025 - * * SPDX-License-Identifier: Apache-2.0 */ use itertools::Itertools; use winnow::{ - combinator::{eof, opt, preceded, repeat_till}, Parser, + combinator::{eof, opt, preceded, repeat_till}, }; use crate::kernel::Settings; diff --git a/tackler-core/src/parser/tackler_parser.rs b/tackler-core/src/parser/tackler_parser.rs index bc9b534..bab90fe 100644 --- a/tackler-core/src/parser/tackler_parser.rs +++ b/tackler-core/src/parser/tackler_parser.rs @@ -1,11 +1,10 @@ /* * Tackler-NG 2023-2025 - * * SPDX-License-Identifier: Apache-2.0 */ -use crate::parser::parts::txns::parse_txns; use crate::parser::Stream; +use crate::parser::parts::txns::parse_txns; use std::fmt::Write; use std::error::Error; diff --git a/tackler-core/src/report/balance_group_reporter.rs b/tackler-core/src/report/balance_group_reporter.rs index 7298dfa..361b3de 100644 --- a/tackler-core/src/report/balance_group_reporter.rs +++ b/tackler-core/src/report/balance_group_reporter.rs @@ -5,11 +5,11 @@ use crate::kernel::accumulator::TxnGroupByOp; use crate::kernel::report_item_selector::BalanceSelector; -use crate::kernel::{accumulator, BalanceGroupSettings}; +use crate::kernel::{BalanceGroupSettings, accumulator}; use crate::kernel::{BalanceSettings, Settings}; use crate::model::{Transaction, TxnSet}; -use crate::report::{write_acc_sel_checksum, write_report_timezone, Report}; -use crate::report::{write_price_metadata, BalanceReporter}; +use crate::report::{BalanceReporter, write_price_metadata}; +use crate::report::{Report, write_acc_sel_checksum, write_report_timezone}; use jiff::tz::TimeZone; use std::error::Error; use std::io; diff --git a/tackler-core/src/report/balance_reporter.rs b/tackler-core/src/report/balance_reporter.rs index c43af2a..ee86084 100644 --- a/tackler-core/src/report/balance_reporter.rs +++ b/tackler-core/src/report/balance_reporter.rs @@ -9,7 +9,7 @@ use crate::kernel::report_item_selector::{ }; use crate::kernel::{BalanceSettings, Settings}; use crate::model::{BalanceTreeNode, TxnSet}; -use crate::report::{write_acc_sel_checksum, write_price_metadata, write_report_timezone, Report}; +use crate::report::{Report, write_acc_sel_checksum, write_price_metadata, write_report_timezone}; use itertools::Itertools; use rust_decimal::prelude::Zero; use rust_decimal::{Decimal, RoundingStrategy}; diff --git a/tackler-core/src/report/register_reporter.rs b/tackler-core/src/report/register_reporter.rs index 67c1a01..b04859d 100644 --- a/tackler-core/src/report/register_reporter.rs +++ b/tackler-core/src/report/register_reporter.rs @@ -3,16 +3,16 @@ * SPDX-License-Identifier: Apache-2.0 */ +use crate::kernel::Settings; use crate::kernel::accumulator; use crate::kernel::report_item_selector::{ RegisterAllSelector, RegisterByAccountSelector, RegisterSelector, }; use crate::kernel::report_settings::RegisterSettings; -use crate::kernel::Settings; use crate::model::{RegisterEntry, TxnSet}; -use crate::report::{write_acc_sel_checksum, write_price_metadata, write_report_timezone, Report}; -use jiff::tz::TimeZone; +use crate::report::{Report, write_acc_sel_checksum, write_price_metadata, write_report_timezone}; use jiff::Zoned; +use jiff::tz::TimeZone; use std::error::Error; use std::io; use tackler_api::txn_ts; diff --git a/tackler-rs/src/regex/serde/full_haystack_matcher.rs b/tackler-rs/src/regex/serde/full_haystack_matcher.rs index f687869..e498033 100644 --- a/tackler-rs/src/regex/serde/full_haystack_matcher.rs +++ b/tackler-rs/src/regex/serde/full_haystack_matcher.rs @@ -1,6 +1,5 @@ /* * Tackler-NG 2024 - * * SPDX-License-Identifier: Apache-2.0 OR MIT */ @@ -17,7 +16,7 @@ use std::{ }; use crate::regex::{new_full_haystack_regex, peeled_pattern}; -use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error}; /// A wrapper type which implements `Serialize` and `Deserialize` for /// types involving `Regex`