Apply a bunch of clippy lints

This commit is contained in:
Piv
2023-08-01 18:21:47 +09:30
parent f992efc018
commit 2485e45026
8 changed files with 80 additions and 81 deletions

View File

@@ -1,9 +1,6 @@
use core::panic;
use std::{
collections::HashMap,
io::{Read, Write},
sync::mpsc,
thread,
};
use chrono::NaiveDateTime;
@@ -31,15 +28,26 @@ struct Product {
source_allocated_amount: Option<f64>,
}
pub struct CreateProductInputs<E, S, T, P, Di>
where
E: Read,
S: Read,
T: Read,
P: Read,
Di: Read,
{
pub encounters: csv::Reader<E>,
pub services: csv::Reader<S>,
pub transfers: csv::Reader<T>,
pub procedures: csv::Reader<P>,
pub diagnoses: csv::Reader<Di>,
}
// TODO: Build from linked dataset is pretty hard, it potentially requires knowing everything abuot the previous year's
// cosing run (BSCO, Dataset_Encounter_Cache, etc).
pub fn create_products<D, E, S, T, P, Di, O>(
definitions: &mut csv::Reader<D>,
encounters: &mut csv::Reader<E>,
services: &mut csv::Reader<S>,
transfers: &mut csv::Reader<T>,
procedures: &mut csv::Reader<P>,
diagnoses: &mut csv::Reader<Di>,
product_inputs: CreateProductInputs<E, S, T, P, Di>,
// TODO: Looks kind of bad, any other way around it? I'd rather not have to depend on crossbeam as well
output: &mut csv::Writer<O>,
// TODO: Default to 10 million or something sane
@@ -82,7 +90,7 @@ where
// TODO: Try with and without rayon, should be able to help I think as we're going through so much data sequentially,
// although we're still likely to be bottlenecked by just write-speed
let mut encounters = encounters;
let mut encounters = product_inputs.encounters;
let headers = encounters.headers()?.clone();
for encounter in encounters.records() {
@@ -105,9 +113,9 @@ where
}
let field = field.unwrap();
if filter.equal {
return filter.value == *field;
filter.value == *field
} else {
return filter.value != *field;
filter.value != *field
}
}))
&& (definition.constraints.is_empty()
@@ -130,7 +138,7 @@ where
}
// TODO: Generate the built service
output.serialize(Product::default());
output.serialize(Product::default())?;
}
// Now do the same with transfers, services, etc, referencing the encounter reader by using the