commit f04e17f15ae17732148723c1df4d55c52eea7f5c
parent 7de57eb035e1759307b3f170f89b12b145390b31
Author: Antoine A <>
Date: Fri, 3 Apr 2026 13:23:30 +0200
common: fmt and clean code
Diffstat:
20 files changed, 44 insertions(+), 55 deletions(-)
diff --git a/common/http-client/src/builder.rs b/common/http-client/src/builder.rs
@@ -21,8 +21,7 @@ use http::{
HeaderMap, HeaderName, HeaderValue, StatusCode,
header::{self},
};
-use http_body_util::BodyExt;
-use http_body_util::{BodyDataStream, Full};
+use http_body_util::{BodyDataStream, BodyExt, Full};
use hyper::{Method, body::Bytes};
use serde::{Serialize, de::DeserializeOwned};
use tracing::{Level, trace};
diff --git a/common/taler-api/src/api/revenue.rs b/common/taler-api/src/api/revenue.rs
@@ -28,6 +28,7 @@ use taler_common::{
api_revenue::{RevenueConfig, RevenueIncomingHistory},
};
+use super::TalerApi;
use crate::{
api::RouterUtils as _,
auth::AuthMethod,
@@ -35,8 +36,6 @@ use crate::{
error::ApiResult,
};
-use super::TalerApi;
-
pub trait Revenue: TalerApi {
fn history(
&self,
diff --git a/common/taler-api/src/api/transfer.rs b/common/taler-api/src/api/transfer.rs
@@ -32,6 +32,7 @@ use taler_common::{
error_code::ErrorCode,
};
+use super::TalerApi;
use crate::{
constants::PREPARED_TRANSFER_API_VERSION,
crypto::check_eddsa_signature,
@@ -39,8 +40,6 @@ use crate::{
json::Req,
};
-use super::TalerApi;
-
pub trait PreparedTransfer: TalerApi {
fn supported_formats(&self) -> &[SubjectFormat];
fn registration(
diff --git a/common/taler-api/src/api/wire.rs b/common/taler-api/src/api/wire.rs
@@ -34,6 +34,7 @@ use taler_common::{
error_code::ErrorCode,
};
+use super::TalerApi;
use crate::{
api::RouterUtils as _,
auth::AuthMethod,
@@ -42,8 +43,6 @@ use crate::{
json::Req,
};
-use super::TalerApi;
-
pub trait WireGateway: TalerApi {
fn transfer(
&self,
diff --git a/common/taler-api/src/db.rs b/common/taler-api/src/db.rs
@@ -22,9 +22,9 @@ use jiff::{
tz::TimeZone,
};
use sqlx::{
- Decode, Error, PgPool, QueryBuilder, Type, error::BoxDynError, postgres::PgRow, query::Query,
+ Decode, Error, PgPool, Postgres, QueryBuilder, Row, Type, error::BoxDynError, postgres::PgRow,
+ query::Query,
};
-use sqlx::{Postgres, Row};
use taler_common::{
api_common::SafeU64,
api_params::{History, Page},
diff --git a/common/taler-api/src/notification.rs b/common/taler-api/src/notification.rs
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2024-2025 Taler Systems SA
+ Copyright (C) 2024, 2025, 2026 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -14,8 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-use std::hash::Hash;
-use std::sync::Arc;
+use std::{hash::Hash, sync::Arc};
use dashmap::DashMap;
use tokio::sync::watch::{self, Receiver};
diff --git a/common/taler-common/src/api_revenue.rs b/common/taler-common/src/api_revenue.rs
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2025 Taler Systems SA
+ Copyright (C) 2025, 2026 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -16,10 +16,10 @@
//! Type for the Taler Wire Gateway HTTP API <https://docs.taler.net/core/api-bank-wire.html#taler-wire-gateway-http-api>
-use crate::types::{amount::Amount, payto::PaytoURI, timestamp::TalerTimestamp};
+use serde::{Deserialize, Serialize};
use super::api_common::SafeU64;
-use serde::{Deserialize, Serialize};
+use crate::types::{amount::Amount, payto::PaytoURI, timestamp::TalerTimestamp};
/// <https://docs.taler.net/core/api-bank-revenue.html#tsref-type-RevenueConfig>
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/common/taler-common/src/api_transfer.rs b/common/taler-common/src/api_transfer.rs
@@ -17,17 +17,16 @@
//! Type for the Taler Wire Transfer Gateway HTTP API <https://docs.taler.net/core/api-bank-transfer.html#taler-prepared-transfer-http-api>
use compact_str::CompactString;
+use serde::{Deserialize, Serialize};
use url::Url;
+use super::api_common::EddsaPublicKey;
use crate::{
api_common::EddsaSignature,
db::IncomingType,
types::{amount::Amount, timestamp::TalerTimestamp},
};
-use super::api_common::EddsaPublicKey;
-use serde::{Deserialize, Serialize};
-
/// <https://docs.taler.net/core/api-bank-transfer.html#tsref-type-SubjectFormat>
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
diff --git a/common/taler-common/src/api_wire.rs b/common/taler-common/src/api_wire.rs
@@ -17,16 +17,15 @@
//! Type for the Taler Wire Gateway HTTP API <https://docs.taler.net/core/api-bank-wire.html#taler-wire-gateway-http-api>
use compact_str::CompactString;
+use serde::{Deserialize, Serialize};
use url::Url;
+use super::api_common::{EddsaPublicKey, HashCode, SafeU64, ShortHashCode, WadId};
use crate::{
api_common::EddsaSignature,
types::{amount::Amount, payto::PaytoURI, timestamp::TalerTimestamp},
};
-use super::api_common::{EddsaPublicKey, HashCode, SafeU64, ShortHashCode, WadId};
-use serde::{Deserialize, Serialize};
-
/// <https://docs.taler.net/core/api-bank-wire.html#tsref-type-WireConfig>
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WireConfig<'a> {
diff --git a/common/taler-common/src/config.rs b/common/taler-common/src/config.rs
@@ -45,9 +45,8 @@ pub mod parser {
use indexmap::IndexMap;
use tracing::{trace, warn};
- use crate::config::{Line, Location};
-
use super::{Config, ValueErr};
+ use crate::config::{Line, Location};
#[derive(Debug, thiserror::Error)]
pub enum ConfigErr {
@@ -965,13 +964,12 @@ mod test {
use tracing::error;
+ use super::{Config, Section, Value};
use crate::{
config::parser::ConfigSource,
types::amount::{self, Currency},
};
- use super::{Config, Section, Value};
-
const SOURCE: ConfigSource = ConfigSource::new("test", "test", "test");
#[track_caller]
diff --git a/common/taler-common/src/db.rs b/common/taler-common/src/db.rs
@@ -21,10 +21,9 @@ use std::{
};
use sqlx::{
- Connection, Executor, PgPool, Row,
- postgres::{PgConnectOptions, PgPoolOptions},
+ Connection, Executor, PgConnection, PgPool, Row,
+ postgres::{PgConnectOptions, PgPoolOptions, PgRow},
};
-use sqlx::{PgConnection, postgres::PgRow};
use tracing::{debug, info};
#[derive(Debug, Clone, Copy, PartialEq, Eq, sqlx::Type)]
diff --git a/common/taler-common/src/lib.rs b/common/taler-common/src/lib.rs
@@ -17,7 +17,6 @@
use std::{path::PathBuf, time::Duration};
use config::{Config, parser::ConfigSource};
-use jiff::SignedDuration;
use tracing::error;
use tracing_subscriber::util::SubscriberInitExt;
diff --git a/common/taler-common/src/types/payto.rs b/common/taler-common/src/types/payto.rs
@@ -14,14 +14,15 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-use compact_str::CompactString;
-use serde::{Deserialize, Serialize, de::DeserializeOwned};
-use serde_with::{DeserializeFromStr, SerializeDisplay};
use std::{
fmt::{Debug, Display},
ops::Deref,
str::FromStr,
};
+
+use compact_str::CompactString;
+use serde::{Deserialize, Serialize, de::DeserializeOwned};
+use serde_with::{DeserializeFromStr, SerializeDisplay};
use url::Url;
use super::{
diff --git a/common/taler-test-utils/src/lib.rs b/common/taler-test-utils/src/lib.rs
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2024-2025 Taler Systems SA
+ Copyright (C) 2024, 2025, 2026 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -14,10 +14,9 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
+pub use axum::Router;
use taler_common::log::taler_logger;
use tracing_subscriber::util::SubscriberInitExt;
-
-pub use axum::Router;
pub mod db;
pub mod json;
pub mod routine;
diff --git a/rustfmt.toml b/rustfmt.toml
@@ -0,0 +1,2 @@
+imports_granularity = "Crate"
+group_imports = "StdExternalCrate"
diff --git a/taler-apns-relay/src/worker.rs b/taler-apns-relay/src/worker.rs
@@ -18,8 +18,7 @@ use std::time::Duration;
use jiff::Timestamp;
use sqlx::PgPool;
-use taler_common::ExpoBackoffDecorr;
-use taler_common::config::Config;
+use taler_common::{ExpoBackoffDecorr, config::Config};
use tracing::{error, info, trace, warn};
use crate::{
diff --git a/taler-cyclos/src/bin/cyclos-codegen.rs b/taler-cyclos/src/bin/cyclos-codegen.rs
@@ -14,8 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-use std::io::Write;
-use std::io::stdout;
+use std::io::{Write, stdout};
use clap::Parser;
use http_client::builder::Req;
diff --git a/taler-magnet-bank/src/api.rs b/taler-magnet-bank/src/api.rs
@@ -305,15 +305,6 @@ mod test {
use std::sync::{Arc, LazyLock};
- use crate::{
- FullHuPayto,
- api::MagnetApi,
- constants::CONFIG_SOURCE,
- db::{self, TxOutKind},
- magnet_api::types::TxStatus,
- magnet_payto,
- };
-
use jiff::{Timestamp, Zoned};
use sqlx::{PgPool, Row as _, postgres::PgRow};
use taler_api::{
@@ -339,6 +330,15 @@ mod test {
server::TestServer,
};
+ use crate::{
+ FullHuPayto,
+ api::MagnetApi,
+ constants::CONFIG_SOURCE,
+ db::{self, TxOutKind},
+ magnet_api::types::TxStatus,
+ magnet_payto,
+ };
+
static PAYTO: LazyLock<FullHuPayto> = LazyLock::new(|| {
magnet_payto("payto://iban/HU02162000031000164800000000?receiver-name=name")
});
diff --git a/taler-magnet-bank/src/db.rs b/taler-magnet-bank/src/db.rs
@@ -896,6 +896,7 @@ mod test {
},
};
+ use super::TxInAdmin;
use crate::{
constants::CONFIG_SOURCE,
db::{
@@ -907,8 +908,6 @@ mod test {
magnet_payto,
};
- use super::TxInAdmin;
-
async fn setup() -> (PoolConnection<Postgres>, PgPool) {
taler_test_utils::db::db_test_setup(CONFIG_SOURCE).await
}
diff --git a/taler-magnet-bank/src/setup.rs b/taler-magnet-bank/src/setup.rs
@@ -22,11 +22,12 @@ use tracing::{info, warn};
use crate::{
config::WorkerCfg,
- magnet_api::{api::MagnetError, oauth::TokenAuth},
-};
-use crate::{
constants::MAGNET_SIGNATURE,
- magnet_api::{api::MagnetErr, client::AuthClient, oauth::Token},
+ magnet_api::{
+ api::{MagnetErr, MagnetError},
+ client::AuthClient,
+ oauth::{Token, TokenAuth},
+ },
};
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, PartialEq, Eq)]