Removed 'allow' attributes that quieted RLS.

This commit is contained in:
scoobybejesus 2019-11-27 21:11:26 -05:00
parent 9d7baef587
commit 7db7daab13
7 changed files with 30 additions and 31 deletions

View File

@ -168,7 +168,7 @@ pub(crate) fn elect_like_kind_treatment(cutoff_date_arg: &mut Option<String>) ->
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<String>) ->
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<String>) ->
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)
}

View File

@ -49,7 +49,7 @@ pub fn import_and_process_final(
let mut action_records_map: HashMap<u32, ActionRecord> = HashMap::new();
let mut raw_account_map: HashMap<u16, RawAccount> = HashMap::new();
let mut account_map: HashMap<u16, Account> = 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.");

View File

@ -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<HashMap<u32,Transaction>, Box<dyn Error>> {
let multiple_incoming_mvmts_per_ar = lk_basis_date_preserved;

View File

@ -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")?;

View File

@ -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)

View File

@ -37,20 +37,20 @@ pub enum Event<I> {
/// type is handled in its own thread and returned to a common `Receiver`
pub struct Events {
rx: mpsc::Receiver<Event<Key>>,
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,
}
}

View File

@ -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<u32, Transaction>,
action_records_map: &HashMap<u32, ActionRecord>,
account_map: &HashMap<u16, Account>,
) {
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<u32, Transaction>,
action_records_map: &HashMap<u32, ActionRecord>,
account_map: &HashMap<u16, Account>,
@ -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<u16, Account>,) {
fn _do_mvmts_know_what_lot_they_are_in(account_map: &HashMap<u16, Account>,) {
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<u16, Account>,) {
}
}
pub fn test_action_records_amts_vs_mvmt_amts(
pub fn _test_action_records_amts_vs_mvmt_amts(
transactions_map: &HashMap<u32, Transaction>,
action_records_map: &HashMap<u32, ActionRecord>,
account_map: &HashMap<u16, Account>,
@ -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::<d128>().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::<d128>().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::<d128>().unwrap();
let amt2 = round_d128_1e2(&amt);
println!("String into d128: {:?}; d128 rounded to 2 places: {:?}", amt, amt2);