diff --git a/Cargo.lock b/Cargo.lock index 5ec955c..adc1b87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "aho-corasick" version = "0.7.6" diff --git a/src/account.rs b/src/account.rs index b81d1de..cc43dbc 100644 --- a/src/account.rs +++ b/src/account.rs @@ -179,7 +179,7 @@ impl Movement { raw_accts: &HashMap, acct_map: &HashMap, txns_map: &HashMap, - )-> Result> { + )-> Result> { let txn = txns_map.get(&self.transaction_key).expect("Couldn't get txn. Tx num invalid?"); match txn.transaction_type(ar_map, raw_accts, acct_map)? { @@ -201,7 +201,7 @@ impl Movement { raw_accts: &HashMap, acct_map: &HashMap, txns_map: &HashMap, - )-> Result> { + )-> Result> { let txn = txns_map.get(&self.transaction_key).expect("Couldn't get txn. Tx num invalid?"); match txn.transaction_type(ar_map, raw_accts, acct_map)? { diff --git a/src/cli_user_choices.rs b/src/cli_user_choices.rs index 62ad7ec..a00f717 100644 --- a/src/cli_user_choices.rs +++ b/src/cli_user_choices.rs @@ -18,7 +18,7 @@ use crate::core_functions::InventoryCostingMethod; use crate::string_utils; -pub fn choose_file_for_import() -> Result> { +pub fn choose_file_for_import() -> Result> { println!("Please input a file (absolute or relative path) to import: "); @@ -26,7 +26,7 @@ pub fn choose_file_for_import() -> Result> { Ok( PathBuf::from(file_str.unwrap()) ) } -pub fn choose_export_dir() -> Result> { +pub fn choose_export_dir() -> Result> { println!("Please input a file path for exports: "); @@ -34,7 +34,7 @@ pub fn choose_export_dir() -> Result> { Ok( PathBuf::from(file_str.unwrap()) ) } -fn _get_path() -> Result<(String), Box> { +fn _get_path() -> Result<(String), Box> { struct MyHelper { completer: FilenameCompleter, @@ -108,7 +108,7 @@ fn _get_path() -> Result<(String), Box> { // } // } -pub fn choose_inventory_costing_method() -> Result> { +pub fn choose_inventory_costing_method() -> Result> { println!("Choose the lot inventory costing method. [Default: 1]"); println!("1. LIFO according to the order the lot was created."); @@ -118,7 +118,7 @@ pub fn choose_inventory_costing_method() -> Result Result> { + fn _costing_method() -> Result> { let mut input = String::new(); let stdin = io::stdin(); @@ -149,7 +149,7 @@ pub fn inv_costing_from_cmd_arg(arg: String) -> Result) -> Result<(bool, String), Box> { +pub fn elect_like_kind_treatment(cutoff_date_arg: &Option) -> Result<(bool, String), Box> { let election: bool; let date: String; @@ -164,7 +164,7 @@ pub fn elect_like_kind_treatment(cutoff_date_arg: &Option) -> Result<(bo let (election, date) = _elect_like_kind_arg(&cutoff_date_arg, provided_date)?; - fn _elect_like_kind_arg(cutoff_date_arg: &Option, provided_date: NaiveDate) -> Result<(bool, String), Box> { + fn _elect_like_kind_arg(cutoff_date_arg: &Option, provided_date: NaiveDate) -> Result<(bool, String), Box> { let mut input = String::new(); let stdin = io::stdin(); @@ -210,7 +210,7 @@ pub fn elect_like_kind_treatment(cutoff_date_arg: &Option) -> Result<(bo let (election, date) = _no_elect_like_kind_arg()?; - fn _no_elect_like_kind_arg() -> Result<(bool, String), Box> { + fn _no_elect_like_kind_arg() -> Result<(bool, String), Box> { let mut input = String::new(); let stdin = io::stdin(); diff --git a/src/core_functions.rs b/src/core_functions.rs index 4fa6d08..a5f9157 100644 --- a/src/core_functions.rs +++ b/src/core_functions.rs @@ -50,7 +50,7 @@ pub fn import_and_process_final( HashMap, HashMap, Option -), Box> { +), Box> { let mut transactions_map: HashMap = HashMap::new(); let mut action_records_map: HashMap = HashMap::new(); @@ -80,7 +80,7 @@ pub fn import_and_process_final( action_records: &mut HashMap, raw_acct_map: &mut HashMap, acct_map: &mut HashMap, - ) -> Result<(), Box> { + ) -> Result<(), Box> { let file = File::open(import_file_path)?; println!("CSV ledger file opened successfully.\n"); diff --git a/src/create_lots_mvmts.rs b/src/create_lots_mvmts.rs index 07f394c..29002c8 100644 --- a/src/create_lots_mvmts.rs +++ b/src/create_lots_mvmts.rs @@ -22,7 +22,7 @@ pub fn create_lots_and_movements( raw_acct_map: &HashMap, acct_map: &HashMap, lot_map: &HashMap<(RawAccount, u32), Lot>, -) -> Result, Box> { +) -> Result, Box> { // Set values to be referred to repeatedly, potentially, in Incoming Exchange transactions let multiple_incoming_mvmts_per_ar = match &likekind_settings { @@ -579,7 +579,7 @@ fn get_base_and_quote_acct_for_dual_actionrecord_flow_tx( raw_acct_map: &HashMap, acct_map: &HashMap, txns_map: &HashMap, -) -> Result<(u16, u16), Box> { +) -> Result<(u16, u16), Box> { let txn = txns_map.get(&txn_num).expect("Couldn't get txn. Tx num invalid?"); let og_flow_ar = ar_map.get(txn.action_record_idx_vec.first().unwrap()).unwrap(); diff --git a/src/csv_export.rs b/src/csv_export.rs index e85327b..8523e64 100644 --- a/src/csv_export.rs +++ b/src/csv_export.rs @@ -202,7 +202,7 @@ pub fn _5_transaction_mvmt_summaries_to_csv( raw_acct_map: &HashMap, acct_map: &HashMap, txns_map: &HashMap, -) -> Result<(), Box> { +) -> Result<(), Box> { let mut rows: Vec> = [].to_vec(); let mut header: Vec = [].to_vec(); diff --git a/src/csv_import_accts_txns.rs b/src/csv_import_accts_txns.rs index 62e5cdb..4aa7ff2 100644 --- a/src/csv_import_accts_txns.rs +++ b/src/csv_import_accts_txns.rs @@ -19,7 +19,7 @@ pub fn import_accounts( rdr: &mut csv::Reader, raw_acct_map: &mut HashMap, acct_map: &mut HashMap, -) -> Result<(), Box> { +) -> Result<(), Box> { let header1: csv::StringRecord; header1 = rdr.headers()?.clone(); // account_num @@ -119,7 +119,7 @@ pub fn import_transactions( action_records: &mut HashMap, raw_acct_map: &mut HashMap, acct_map: &mut HashMap, -) -> Result<(), Box> { +) -> Result<(), Box> { let mut this_tx_number = 0; let mut this_ar_number = 0; diff --git a/src/import_cost_proceeds_etc.rs b/src/import_cost_proceeds_etc.rs index 696f210..bda779e 100644 --- a/src/import_cost_proceeds_etc.rs +++ b/src/import_cost_proceeds_etc.rs @@ -18,7 +18,7 @@ pub fn add_cost_basis_to_movements( raw_acct_map: &HashMap, acct_map: &HashMap, txns_map: &HashMap, -) -> Result<(), Box> { +) -> Result<(), Box> { let length = txns_map.len(); @@ -152,7 +152,7 @@ pub fn add_proceeds_to_movements( raw_acct_map: &HashMap, acct_map: &HashMap, txns_map: &HashMap, -) -> Result<(), Box> { +) -> Result<(), Box> { let length = txns_map.len(); @@ -209,7 +209,7 @@ pub fn apply_like_kind_treatment( raw_acct_map: &HashMap, acct_map: &HashMap, txns_map: &HashMap, -) -> Result<(), Box> { +) -> Result<(), Box> { let length = txns_map.len(); for txn_num in 1..=length { @@ -234,7 +234,7 @@ fn update_current_txn_for_prior_likekind_treatment( raw_acct_map: &HashMap, acct_map: &HashMap, txns_map: &HashMap, -) -> Result<(), Box> { +) -> Result<(), Box> { let mut sum_of_outgoing_cost_basis_in_ar = d128!(0); let txn = txns_map.get(&txn_num).unwrap(); @@ -300,7 +300,7 @@ fn perform_likekind_treatment_on_txn( raw_acct_map: &HashMap, acct_map: &HashMap, txns_map: &HashMap, -) -> Result<(), Box> { +) -> Result<(), Box> { let txn = txns_map.get(&txn_num).unwrap(); let tx_type = txn.transaction_type(ars, raw_acct_map, acct_map)?; diff --git a/src/main.rs b/src/main.rs index 043bb6e..981abb9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -70,7 +70,7 @@ struct Cli { } -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let args = Cli::from_args(); @@ -107,13 +107,13 @@ fn main() -> Result<(), Box> { shall_we_proceed()?; - fn shall_we_proceed() -> Result<(), Box> { + fn shall_we_proceed() -> Result<(), Box> { println!("Shall we proceed? [Y/n] "); _proceed()?; - fn _proceed() -> Result<(), Box> { + fn _proceed() -> Result<(), Box> { let mut input = String::new(); let stdin = io::stdin(); @@ -171,7 +171,7 @@ fn main() -> Result<(), Box> { should_export = export_reports_to_output_dir(&mut settings)?; - fn export_reports_to_output_dir(settings: &mut ImportProcessParameters) -> Result<(bool), Box> { + fn export_reports_to_output_dir(settings: &mut ImportProcessParameters) -> Result<(bool), Box> { println!("\nThe directory currently selected for exporting reports is: {}", settings.export_path.to_str().unwrap()); @@ -182,7 +182,7 @@ fn main() -> Result<(), Box> { let choice = _export(settings)?; - fn _export(settings: &mut ImportProcessParameters) -> Result<(bool), Box> { + fn _export(settings: &mut ImportProcessParameters) -> Result<(bool), Box> { let mut input = String::new(); let stdin = io::stdin(); diff --git a/src/transaction.rs b/src/transaction.rs index baa2ded..457eca4 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -31,7 +31,7 @@ impl Transaction { ars: &HashMap, raw_acct_map: &HashMap, acct_map: &HashMap, - ) -> Result> { + ) -> Result> { if self.action_record_idx_vec.len() == 1 { Ok(TxType::Flow) @@ -112,7 +112,7 @@ impl Transaction { ars: &HashMap, raw_accts: &HashMap, acct_map: &HashMap - ) -> Result<(u16, u16), Box> { + ) -> Result<(u16, u16), Box> { assert_eq!(self.transaction_type(ars, raw_accts, acct_map)?, TxType::Exchange, "This can only be called on exchange transactions."); @@ -152,7 +152,7 @@ impl Transaction { raw_acct_map: &HashMap, acct_map: &HashMap, txns_map: &HashMap, - ) -> Result>, Box> { + ) -> Result>, Box> { let mut flow_or_outgoing_exchange_movements = [].to_vec();