chore: clippy clean across the workspace, all targets

Zero warnings from `cargo clippy --workspace --all-targets`, which is now
a hard rule rather than "clean except pre-existing":

- ChartOfAccounts::add takes the Account it registers instead of eight
  loose parameters (too_many_arguments); Ledger::add_account builds it.
  Same validation, same errors.
- close_period tool: collapse the nested if-let into a let chain.
- iif.rs docs: the IIF layout example shows tabs as `\t` instead of
  literal tab characters (tabs_in_doc_comments).
- Tests: drop an unused binding; assert! instead of assert_eq! against a
  literal bool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MtYEaR6M6Ybdhm6X98BWNu
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-11 19:24:10 -07:00
1 parent 03212265ce
commit 42e600bbf2
7 files changed
+37 -56

No files matched your search

+7 -27
View File
@@ -84,40 +84,20 @@ pub struct ChartOfAccounts {
impl ChartOfAccounts {
/// Register an account. Codes must be unique and non-empty; a parent, if
/// given, must already exist.
pub fn add(
&mut self,
id: AccountId,
code: &str,
name: &str,
account_type: AccountType,
parent: Option<AccountId>,
placeholder: bool,
currency: Currency,
) -> Result<(), LedgerError> {
if code.is_empty() {
pub fn add(&mut self, account: Account) -> Result<(), LedgerError> {
if account.code.is_empty() {
return Err(LedgerError::EmptyAccountCode);
}
if self.by_code.contains_key(code) {
return Err(LedgerError::DuplicateAccountCode(code.to_string()));
if self.by_code.contains_key(&account.code) {
return Err(LedgerError::DuplicateAccountCode(account.code));
}
if let Some(p) = parent
if let Some(p) = account.parent
&& !self.accounts.contains_key(&p)
{
return Err(LedgerError::UnknownParentAccount(p));
}
self.by_code.insert(code.to_string(), id);
self.accounts.insert(
id,
Account {
id,
code: code.to_string(),
name: name.to_string(),
account_type,
parent,
placeholder,
currency,
},
);
self.by_code.insert(account.code.clone(), account.id);
self.accounts.insert(account.id, account);
Ok(())
}
+9 -9
View File
@@ -7,10 +7,10 @@
//! audit trail and what will make the future oracle harness trustworthy.
use crate::{
AccountId, AccountType, AgingRow, Asset, AssetId, AssetStatus, Bill, BillId, ChartOfAccounts,
Class, ClassId, Currency, Customer, CustomerId, DocumentLine, DocumentStatus, EntryId,
EntryStatus, Invoice, InvoiceId, JournalEntry, JournalLine, LedgerError, Money, NewAsset,
Period, PeriodId, PeriodStatus, Side, Vendor, VendorId, arap, assets,
Account, AccountId, AccountType, AgingRow, Asset, AssetId, AssetStatus, Bill, BillId,
ChartOfAccounts, Class, ClassId, Currency, Customer, CustomerId, DocumentLine, DocumentStatus,
EntryId, EntryStatus, Invoice, InvoiceId, JournalEntry, JournalLine, LedgerError, Money,
NewAsset, Period, PeriodId, PeriodStatus, Side, Vendor, VendorId, arap, assets,
payroll::{
PayrollAccounts, PayrollLine, PayrollRun, PayrollRunId, payroll_entry_plan,
payroll_remit_plan, validate_payroll_lines,
@@ -220,15 +220,15 @@ impl Ledger {
) -> Result<AccountId, LedgerError> {
let id = self.next_account_id;
self.next_account_id += 1;
self.chart.add(
self.chart.add(Account {
id,
code,
name,
code: code.to_string(),
name: name.to_string(),
account_type,
parent,
placeholder,
self.base_currency,
)?;
currency: self.base_currency,
})?;
Ok(id)
}
+1 -1
View File
@@ -550,7 +550,7 @@ fn cash_flow_with_registered_asset_and_disposal() {
false,
)
.unwrap();
let revenue = ledger
ledger
.add_account("4000", "Service Revenue", AccountType::Revenue, None, false)
.unwrap();
let gain = ledger