From b8f8d8cdfb66b870ba45c95f82365bf1e4b64c63 Mon Sep 17 00:00:00 2001 From: Jacob Kiers Date: Sat, 22 Nov 2025 15:42:12 +0000 Subject: [PATCH] Fix clippy warnings --- AGENTS.md | 3 ++- banks2ff/src/adapters/gocardless/client.rs | 5 ++--- banks2ff/src/core/sync.rs | 24 ++++++++++------------ 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 40e9247..b334dda 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -148,6 +148,7 @@ mod tests { - Use `cargo fmt` for formatting - Use `cargo clippy` for linting - Ensure documentation for public APIs +- _ALWAYS_ format and lint after making a change, and fix the linting errors ### 4. Commit Standards - Commit both code and tests together @@ -207,4 +208,4 @@ mod tests { ### Technical Documentation - **docs/architecture.md**: Detailed technical specifications, implementation details, and developer-focused content - **specs/**: Implementation planning, API specifications, and historical context -- **Code Comments**: Use for implementation details and complex logic explanations \ No newline at end of file +- **Code Comments**: Use for implementation details and complex logic explanations diff --git a/banks2ff/src/adapters/gocardless/client.rs b/banks2ff/src/adapters/gocardless/client.rs index b4f56be..06c0462 100644 --- a/banks2ff/src/adapters/gocardless/client.rs +++ b/banks2ff/src/adapters/gocardless/client.rs @@ -119,12 +119,11 @@ impl TransactionSource for GoCardlessAdapter { } // Optimization: Stop if we found all wanted accounts - if let Some(_) = wanted_set { - if found_count >= target_count && target_count > 0 { + if wanted_set.is_some() + && found_count >= target_count && target_count > 0 { info!("Found all {} wanted accounts. Stopping search.", target_count); return Ok(accounts); } - } } } } diff --git a/banks2ff/src/core/sync.rs b/banks2ff/src/core/sync.rs index 966f185..8a9be8c 100644 --- a/banks2ff/src/core/sync.rs +++ b/banks2ff/src/core/sync.rs @@ -166,21 +166,19 @@ async fn process_single_account( if dry_run { info!("[DRY RUN] Would create transaction {}", tx.internal_id); stats.created += 1; - } else { - if let Err(e) = destination.create_transaction(&dest_id, &tx).await { - // Firefly might still reject it as duplicate if hash matches, even if we didn't find it via heuristic - // (unlikely if heuristic is good, but possible) - let err_str = e.to_string(); - if err_str.contains("422") || err_str.contains("Duplicate") { - warn!("Duplicate rejected by Firefly: {}", tx.internal_id); - stats.duplicates += 1; - } else { - tracing::error!("Failed to create transaction: {}", e); - stats.errors += 1; - } + } else if let Err(e) = destination.create_transaction(&dest_id, &tx).await { + // Firefly might still reject it as duplicate if hash matches, even if we didn't find it via heuristic + // (unlikely if heuristic is good, but possible) + let err_str = e.to_string(); + if err_str.contains("422") || err_str.contains("Duplicate") { + warn!("Duplicate rejected by Firefly: {}", tx.internal_id); + stats.duplicates += 1; } else { - stats.created += 1; + tracing::error!("Failed to create transaction: {}", e); + stats.errors += 1; } + } else { + stats.created += 1; } } }