|
@@ -8,9 +8,10 @@ fn check_equal_sum(root: &Root) -> Result<(), DataError> {
|
|
|
for le in root.all_ledger_data() {
|
|
|
let Some(mono) = le.mono_unit() else { continue };
|
|
|
|
|
|
- let net = le.balances.iter().fold(Some(Decimal::ZERO), |acc, b| {
|
|
|
- acc.and_then(|acc| acc.checked_add(*b.amount))
|
|
|
- });
|
|
|
+ let net = le
|
|
|
+ .balances
|
|
|
+ .iter()
|
|
|
+ .try_fold(Decimal::ZERO, |acc, b| acc.checked_add(*b.amount));
|
|
|
if net != Some(Decimal::ZERO) {
|
|
|
let report = ariadne::Report::build(ariadne::ReportKind::Error, le.span()).with_labels(
|
|
|
le.balances.iter().map(|v| {
|