From 5b8080cae8bc49f14a2d575c6e15e722a9f8a44f Mon Sep 17 00:00:00 2001 From: quambene Date: Tue, 19 Dec 2023 02:43:00 +0100 Subject: [PATCH] Format code --- src/data_loader/tabular_data.rs | 14 ++++++-------- src/data_sources/csv.rs | 3 +-- src/data_sources/mod.rs | 8 +++++--- src/data_sources/postgres.rs | 3 +-- src/email_builder/message/reader.rs | 3 +-- src/email_builder/mod.rs | 3 +-- src/email_builder/sender.rs | 3 +-- src/email_transmission/status.rs | 3 +-- 8 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/data_loader/tabular_data.rs b/src/data_loader/tabular_data.rs index 2a881d5..557fbc7 100644 --- a/src/data_loader/tabular_data.rs +++ b/src/data_loader/tabular_data.rs @@ -1,17 +1,15 @@ -use std::path::PathBuf; - +use crate::{ + arg, + data_sources::{query_postgres, read_csv}, + email_builder::Receiver, +}; use anyhow::{anyhow, Context}; use clap::ArgMatches; use polars::{ chunked_array::ChunkedArray, prelude::{DataFrame, TakeRandom, Utf8Type}, }; - -use crate::{ - arg, - data_sources::{query_postgres, read_csv}, - email_builder::Receiver, -}; +use std::path::PathBuf; pub struct TabularData; diff --git a/src/data_sources/csv.rs b/src/data_sources/csv.rs index 31974a8..5e36497 100644 --- a/src/data_sources/csv.rs +++ b/src/data_sources/csv.rs @@ -1,3 +1,4 @@ +use crate::arg; use anyhow::{anyhow, Context}; use clap::ArgMatches; use polars::prelude::{CsvReader, CsvWriter, DataFrame, SerReader, SerWriter}; @@ -7,8 +8,6 @@ use std::{ time::SystemTime, }; -use crate::arg; - pub fn read_csv(csv_file: &Path) -> Result { println!("Reading csv file '{}' ...", csv_file.display()); let reader = CsvReader::from_path(csv_file)?.has_header(true); diff --git a/src/data_sources/mod.rs b/src/data_sources/mod.rs index 5bf3bfe..40d86ff 100644 --- a/src/data_sources/mod.rs +++ b/src/data_sources/mod.rs @@ -3,7 +3,9 @@ mod image; mod postgres; mod ssh_tunnel; -pub use self::csv::{read_csv, write_csv}; -pub use self::image::write_image; -pub use self::postgres::{query_postgres, ConnVars}; +pub use self::{ + csv::{read_csv, write_csv}, + image::write_image, + postgres::{query_postgres, ConnVars}, +}; pub use ssh_tunnel::SshTunnel; diff --git a/src/data_sources/postgres.rs b/src/data_sources/postgres.rs index 31b5424..4527eae 100644 --- a/src/data_sources/postgres.rs +++ b/src/data_sources/postgres.rs @@ -1,3 +1,4 @@ +use crate::{arg, data_sources::SshTunnel}; use anyhow::{Context, Result}; use clap::ArgMatches; use connectorx::{ @@ -11,8 +12,6 @@ use postgres::NoTls; use std::{env, fmt}; use url::Url; -use crate::{arg, data_sources::SshTunnel}; - pub struct Password(pub String); impl fmt::Debug for Password { diff --git a/src/email_builder/message/reader.rs b/src/email_builder/message/reader.rs index fbf53be..96915c0 100644 --- a/src/email_builder/message/reader.rs +++ b/src/email_builder/message/reader.rs @@ -1,8 +1,7 @@ -use std::{fs, path::Path}; - use crate::arg; use anyhow::anyhow; use clap::ArgMatches; +use std::{fs, path::Path}; #[derive(Debug)] pub struct Reader; diff --git a/src/email_builder/mod.rs b/src/email_builder/mod.rs index 33e5e66..5d6945c 100644 --- a/src/email_builder/mod.rs +++ b/src/email_builder/mod.rs @@ -7,8 +7,7 @@ mod sender; pub use bulk_email::BulkEmail; pub use email::Email; -pub use message::Message; -pub use message::MessageTemplate; +pub use message::{Message, MessageTemplate}; pub use mime::MimeFormat; pub use receiver::Receiver; pub use sender::Sender; diff --git a/src/email_builder/sender.rs b/src/email_builder/sender.rs index 4be9847..b92a7dc 100644 --- a/src/email_builder/sender.rs +++ b/src/email_builder/sender.rs @@ -1,8 +1,7 @@ +use crate::arg; use anyhow::anyhow; use clap::ArgMatches; -use crate::arg; - pub struct Sender; impl Sender { diff --git a/src/email_transmission/status.rs b/src/email_transmission/status.rs index 33db63a..2c0cdd8 100644 --- a/src/email_transmission/status.rs +++ b/src/email_transmission/status.rs @@ -1,6 +1,5 @@ -use std::fmt; - use crate::helper::{format_green, format_red}; +use std::fmt; #[derive(Debug, Clone)] pub enum Status {