Fix some clippy lints

This commit is contained in:
Joshua Coles 2024-08-09 09:55:27 +01:00
parent 08766dc0e0
commit 21a63a10a4
5 changed files with 306 additions and 329 deletions

624
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@ impl AppError {
impl IntoResponse for AppError { impl IntoResponse for AppError {
fn into_response(self) -> Response { fn into_response(self) -> Response {
let status_code = match self { let status_code = match self {
AppError::BadRequest(_) => StatusCode::BAD_REQUEST,
_ => StatusCode::INTERNAL_SERVER_ERROR, _ => StatusCode::INTERNAL_SERVER_ERROR,
}; };

View File

@ -29,7 +29,7 @@ pub async fn insert(
for insertions in insertions.chunks(400) { for insertions in insertions.chunks(400) {
let (new_or_updated_insertions, inserted_transaction_ids) = let (new_or_updated_insertions, inserted_transaction_ids) =
whittle_insertions(insertions, &db).await?; whittle_insertions(insertions, db).await?;
if new_or_updated_insertions.is_empty() { if new_or_updated_insertions.is_empty() {
continue; continue;
@ -69,7 +69,7 @@ async fn update_expenditures(
expenditure::Entity::insert_many( expenditure::Entity::insert_many(
new_or_updated_insertions new_or_updated_insertions
.into_iter() .iter()
.flat_map(|i| &i.contained_expenditures) .flat_map(|i| &i.contained_expenditures)
.cloned(), .cloned(),
) )
@ -127,7 +127,7 @@ async fn whittle_insertions<'a>(
// We will only update those where the hash is different to avoid unnecessary updates and // We will only update those where the hash is different to avoid unnecessary updates and
// notifications. // notifications.
let new_or_updated_insertions = insertions let new_or_updated_insertions = insertions
.into_iter() .iter()
.filter(|i| { .filter(|i| {
let hash = i.identity_hash; let hash = i.identity_hash;
!existing_hashes !existing_hashes

View File

@ -1,4 +1,6 @@
#[allow(dead_code)]
mod headings { mod headings {
#[allow(unused_imports)]
pub use super::super::ingestion_logic::headings::*; pub use super::super::ingestion_logic::headings::*;
// Additional FLex headings // Additional FLex headings

View File

@ -43,7 +43,7 @@ pub async fn monzo_batched_csv(
Extension(db): Extension<DatabaseConnection>, Extension(db): Extension<DatabaseConnection>,
multipart: Multipart, multipart: Multipart,
) -> Result<&'static str, AppError> { ) -> Result<&'static str, AppError> {
static CSV_MISSING_ERR_MSG: &'static str = "No CSV file provided. Expected a multipart request with a `csv` field containing the contents of the CSV."; static CSV_MISSING_ERR_MSG: &str = "No CSV file provided. Expected a multipart request with a `csv` field containing the contents of the CSV.";
let csv = extract_csv(multipart) let csv = extract_csv(multipart)
.await .await