From 7db7daab133868cde97238319821fef12e206043 Mon Sep 17 00:00:00 2001 From: scoobybejesus Date: Wed, 27 Nov 2019 21:11:26 -0500 Subject: [PATCH] Removed 'allow' attributes that quieted RLS. --- src/cli_user_choices.rs | 6 +++--- src/crptls_lib/core_functions.rs | 4 ++-- src/crptls_lib/create_lots_mvmts.rs | 2 +- src/export_je.rs | 1 - src/main.rs | 6 +++--- src/mytui/event.rs | 14 +++++++------- src/tests/test.rs | 28 ++++++++++++++-------------- 7 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/cli_user_choices.rs b/src/cli_user_choices.rs index 653050a..0293910 100644 --- a/src/cli_user_choices.rs +++ b/src/cli_user_choices.rs @@ -168,7 +168,7 @@ pub(crate) fn elect_like_kind_treatment(cutoff_date_arg: &mut Option) -> let provided_date = NaiveDate::parse_from_str(&cutoff_date_arg, "%y-%m-%d") .unwrap_or(NaiveDate::parse_from_str(&cutoff_date_arg, "%Y-%m-%d") - .unwrap_or_else(|e| { + .unwrap_or_else(|_| { println!("\nWARN: Date entered after -l command line arg (like-kind cutoff date) has an invalid format."); second_date_try_from_user(&mut cutoff_date_arg).unwrap() } ) ); @@ -268,7 +268,7 @@ pub(crate) fn elect_like_kind_treatment(cutoff_date_arg: &mut Option) -> let successfully_parsed_naive_date = NaiveDate::parse_from_str(&input, "%y-%m-%d") .unwrap_or(NaiveDate::parse_from_str(&input, "%Y-%m-%d") - .unwrap_or_else(|e| { second_date_try_from_user(input).unwrap() } )); + .unwrap_or_else(|_| { second_date_try_from_user(input).unwrap() } )); Ok(successfully_parsed_naive_date) } @@ -285,7 +285,7 @@ pub(crate) fn elect_like_kind_treatment(cutoff_date_arg: &mut Option) -> let successfully_parsed_naive_date = NaiveDate::parse_from_str(&input, "%y-%m-%d") .unwrap_or(NaiveDate::parse_from_str(&input, "%Y-%m-%d") - .unwrap_or_else(|e| { second_date_try_from_user(input).unwrap() } )); + .unwrap_or_else(|_| { second_date_try_from_user(input).unwrap() } )); Ok(successfully_parsed_naive_date) } diff --git a/src/crptls_lib/core_functions.rs b/src/crptls_lib/core_functions.rs index a2c4111..c7f8a67 100644 --- a/src/crptls_lib/core_functions.rs +++ b/src/crptls_lib/core_functions.rs @@ -49,7 +49,7 @@ pub fn import_and_process_final( let mut action_records_map: HashMap = HashMap::new(); let mut raw_account_map: HashMap = HashMap::new(); let mut account_map: HashMap = HashMap::new(); - let mut lot_map: HashMap<(RawAccount, u32), Lot> = HashMap::new(); + let mut _lot_map: HashMap<(RawAccount, u32), Lot> = HashMap::new(); match import_from_csv( input_file_path, @@ -108,7 +108,7 @@ pub fn import_and_process_final( settings.lk_treatment_enabled, settings.lk_cutoff_date, settings.lk_basis_date_preserved, - &mut lot_map, + // &mut lot_map, )?; println!(" Successfully created lots and movements."); diff --git a/src/crptls_lib/create_lots_mvmts.rs b/src/crptls_lib/create_lots_mvmts.rs index c0a4efe..d845ebd 100644 --- a/src/crptls_lib/create_lots_mvmts.rs +++ b/src/crptls_lib/create_lots_mvmts.rs @@ -24,7 +24,7 @@ pub(crate) fn create_lots_and_movements( enable_lk_treatment: bool, like_kind_cutoff_date: NaiveDate, lk_basis_date_preserved: bool, - lot_map: &HashMap<(RawAccount, u32), Lot>, + // lot_map: &HashMap<(RawAccount, u32), Lot>, ) -> Result, Box> { let multiple_incoming_mvmts_per_ar = lk_basis_date_preserved; diff --git a/src/export_je.rs b/src/export_je.rs index 9083839..8dae721 100644 --- a/src/export_je.rs +++ b/src/export_je.rs @@ -62,7 +62,6 @@ depending on the bookkeeping practices you employ."; let date = txn.date; let user_memo = txn.user_memo.to_string(); let auto_memo = txn.get_auto_memo(ars, raw_acct_map,acct_map, &settings.home_currency)?; - let tx_type = txn.transaction_type(&ars, &raw_acct_map, &acct_map)?; writeln!(file, "\n====================================================================================================\n")?; diff --git a/src/main.rs b/src/main.rs index e4391c7..ec2d9ef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,9 @@ // Copyright (c) 2017-2019, scoobybejesus // Redistributions must include the license: https://github.com/scoobybejesus/cryptools/blob/master/LEGAL.txt -#![allow(dead_code)] -#![allow(unused_variables)] -#![allow(unused_assignments)] +// #![allow(dead_code)] +// #![allow(unused_variables)] +// #![allow(unused_assignments)] // Note: the above are possibly temporary, to silence "x was not used" warnings. // #[warn(dead_code)] is the default (same for unused_variables) diff --git a/src/mytui/event.rs b/src/mytui/event.rs index 3f5ad57..add29d8 100644 --- a/src/mytui/event.rs +++ b/src/mytui/event.rs @@ -37,20 +37,20 @@ pub enum Event { /// type is handled in its own thread and returned to a common `Receiver` pub struct Events { rx: mpsc::Receiver>, - input_handle: thread::JoinHandle<()>, - tick_handle: thread::JoinHandle<()>, + _input_handle: thread::JoinHandle<()>, + _tick_handle: thread::JoinHandle<()>, } impl Events { - pub fn new() -> Events { + pub fn _new() -> Events { Events::with_config(Config::default()) } pub fn with_config(config: Config) -> Events { let (tx, rx) = mpsc::channel(); - let input_handle = { + let _input_handle = { let tx = tx.clone(); thread::spawn(move || { let stdin = io::stdin(); @@ -70,7 +70,7 @@ impl Events { }) }; - let tick_handle = { + let _tick_handle = { let tx = tx.clone(); thread::spawn(move || { let tx = tx.clone(); @@ -83,8 +83,8 @@ impl Events { Events { rx, - input_handle, - tick_handle, + _input_handle, + _tick_handle, } } diff --git a/src/tests/test.rs b/src/tests/test.rs index a0171c8..0abbe12 100644 --- a/src/tests/test.rs +++ b/src/tests/test.rs @@ -10,28 +10,28 @@ use crptls::account::{Account}; use crptls::transaction::{Transaction, ActionRecord}; use crptls::decimal_utils::*; -pub fn run_tests( +pub fn _run_tests( transactions_map: &HashMap, action_records_map: &HashMap, account_map: &HashMap, ) { - compare_movements_across_implementations( + _compare_movements_across_implementations( &transactions_map, &action_records_map, &account_map ); - do_mvmts_know_what_lot_they_are_in(&account_map); + _do_mvmts_know_what_lot_they_are_in(&account_map); - test_action_records_amts_vs_mvmt_amts( + _test_action_records_amts_vs_mvmt_amts( &transactions_map, &action_records_map, &account_map ); - test_quantize_from_incoming_multiple_lots_fn(d128!(20), d128!(200), d128!(50)); - test_quantize_from_incoming_multiple_lots_fn(d128!(1), d128!(6), d128!(1234567.1234567896)); + _test_quantize_from_incoming_multiple_lots_fn(d128!(20), d128!(200), d128!(50)); + _test_quantize_from_incoming_multiple_lots_fn(d128!(1), d128!(6), d128!(1234567.1234567896)); // test_dec_rounded("123456789.123456789"); // test_dec_rounded("123456.123456"); // test_dec_rounded("1234567891234.1234567891234"); @@ -44,7 +44,7 @@ pub fn run_tests( } -fn compare_movements_across_implementations( +fn _compare_movements_across_implementations( transactions_map: &HashMap, action_records_map: &HashMap, account_map: &HashMap, @@ -124,9 +124,9 @@ fn compare_movements_across_implementations( fs::write("/tmp/foo2", &line2).expect("Unable to write file"); } -fn do_mvmts_know_what_lot_they_are_in(account_map: &HashMap,) { +fn _do_mvmts_know_what_lot_they_are_in(account_map: &HashMap,) { - for (acct_num, acct) in account_map.iter() { + for (_acct_num, acct) in account_map.iter() { for lot in acct.list_of_lots.borrow().iter() { for mvmt in lot.movements.borrow().iter() { if mvmt.lot_num != lot.lot_number { @@ -138,7 +138,7 @@ fn do_mvmts_know_what_lot_they_are_in(account_map: &HashMap,) { } } -pub fn test_action_records_amts_vs_mvmt_amts( +pub fn _test_action_records_amts_vs_mvmt_amts( transactions_map: &HashMap, action_records_map: &HashMap, account_map: &HashMap, @@ -194,7 +194,7 @@ pub fn test_action_records_amts_vs_mvmt_amts( ); } -fn test_quantize_from_incoming_multiple_lots_fn ( +fn _test_quantize_from_incoming_multiple_lots_fn ( outgoing_mvmt_amt: d128, outgoing_ar_amt: d128, incoming_ar_amt: d128, @@ -220,7 +220,7 @@ fn test_quantize_from_incoming_multiple_lots_fn ( // tentative_inc_amt: 205761.1872427982666 // corresponding_inc_amt: 205761.18724280 -fn test_dec_rounded(random_float_string: &str) { +fn _test_dec_rounded(random_float_string: &str) { let places_past_decimal = d128!(8); let amt = random_float_string.parse::().unwrap(); let amt2 = round_d128_generalized(&amt, places_past_decimal); @@ -228,14 +228,14 @@ fn test_dec_rounded(random_float_string: &str) { // Results of this test suggest that quantize() is off by one. round_d128_1e8() was adjusted accordingly. } -fn test_dec_rounded_1e8(random_float_string: &str) { +fn _test_dec_rounded_1e8(random_float_string: &str) { let amt = random_float_string.parse::().unwrap(); let amt2 = round_d128_1e8(&amt); println!("Float into d128: {:?}; d128 rounded to 8 places: {:?}", amt, amt2); // Results of this test suggest that quantize() is off by one. round_d128_1e8() was adjusted accordingly. } -fn test_dec_rounded_1e2(random_float_string: &str) { +fn _test_dec_rounded_1e2(random_float_string: &str) { let amt = random_float_string.parse::().unwrap(); let amt2 = round_d128_1e2(&amt); println!("String into d128: {:?}; d128 rounded to 2 places: {:?}", amt, amt2);