docx: fix clippy large_enum_variant on main (#779)

A field's buffered result items held an InlineObject inline, which grew past
clippy's large_enum_variant limit with today's object changes. Box it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-11 21:01:43 -04:00 committed by GitHub
parent 48b2468f19
commit 7d1f6a07c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -41,9 +41,11 @@ enum Phase {
Result,
}
/// A buffered piece of a field's result. Objects are boxed: an inline object is much larger than
/// a string.
enum Item {
Text(String),
Obj(InlineObject),
Obj(Box<InlineObject>),
}
struct FieldState {
@ -787,7 +789,7 @@ impl Reader<'_> {
for (it, p) in f.buf {
match it {
Item::Text(t) => self.emit_text(sc, pb, &t, &p),
Item::Obj(o) => self.emit_obj(sc, pb, o, &p),
Item::Obj(o) => self.emit_obj(sc, pb, *o, &p),
}
}
self.emit_obj(sc, pb, InlineObject::FieldEnd, &f.props);
@ -828,7 +830,7 @@ impl Reader<'_> {
for (it, p) in f.buf.drain(..) {
match it {
Item::Text(t) => pb.push_text(&t, &p),
Item::Obj(o) => pb.push_obj(o, &p),
Item::Obj(o) => pb.push_obj(*o, &p),
}
}
}
@ -849,7 +851,7 @@ impl Reader<'_> {
match sink(sc) {
Some(f) => {
if f.phase == Phase::Result && f.buf.len() < 100_000 {
f.buf.push((Item::Obj(o), props.clone()));
f.buf.push((Item::Obj(Box::new(o)), props.clone()));
}
}
_ => pb.push_obj(o, props),