From c531b64dfa2215456baedf1a7a9d8018acc5af71 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 3 Nov 2026 22:04:08 +0000 Subject: [PATCH] address review: warn once when a by-paragraph build is truncated --- crates/pptx/src/write/timing.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/pptx/src/write/timing.rs b/crates/pptx/src/write/timing.rs index ca2b95bac..06b114079 100644 --- a/crates/pptx/src/write/timing.rs +++ b/crates/pptx/src/write/timing.rs @@ -604,9 +604,12 @@ pub fn timing(w: &mut W, x: &mut Exp, anims: &[Animation], shapes: &[Shape], idm shape_index(shapes, 0, &mut by_id); let mut roles_of: std::collections::HashMap> = Default::default(); let mut effect_count = 0usize; + let mut warned = false; for a in anims.iter().take(10_000) { if effect_count >= MAX_EFFECTS { - log::warn!("pptx: more than {MAX_EFFECTS} animation effects; the rest are left out"); + if !warned { + log::warn!("pptx: more than {MAX_EFFECTS} animation effects; the rest are left out"); + } break; } let Some(spid) = idmap.get(a.shape) else { @@ -660,6 +663,10 @@ pub fn timing(w: &mut W, x: &mut Exp, anims: &[Animation], shapes: &[Shape], idm }; let Ok(pi) = u32::try_from(i) else { break }; if effect_count + effs.len() >= MAX_EFFECTS { + if !warned { + log::warn!("pptx: more than {MAX_EFFECTS} animation effects; the rest are left out"); + warned = true; + } break; } effs.push(Eff { a, spid, start, paragraph: Some(pi), grp });