From 4c47fcabbf91db18633e10253fb7cc9ff90652e6 Mon Sep 17 00:00:00 2001 From: Ming-Hung Tsai Date: Mon, 10 May 2021 15:48:21 +0800 Subject: [PATCH] [thin_dump (rust)] Fix missing outputs --- src/thin/dump.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/thin/dump.rs b/src/thin/dump.rs index 47e4b32..f86a299 100644 --- a/src/thin/dump.rs +++ b/src/thin/dump.rs @@ -485,9 +485,8 @@ fn optimise_metadata(md: Metadata) -> Result { //------------------------------------------ -fn emit_leaf(out: &mut dyn xml::MetadataVisitor, b: &Block) -> Result<()> { +fn emit_leaf(v: &mut MappingVisitor, b: &Block) -> Result<()> { use Node::*; - let v = MappingVisitor::new(out); let path = Vec::new(); let kr = KeyRange::new(); @@ -536,12 +535,14 @@ where } fn emit_leaves(ctx: &Context, out: &mut dyn xml::MetadataVisitor, ls: &[u64]) -> Result<()> { + let mut v = MappingVisitor::new(out); let proc = |b| { - emit_leaf(out, &b)?; + emit_leaf(&mut v, &b)?; Ok(()) }; - read_for(ctx.engine.clone(), ls, proc) + read_for(ctx.engine.clone(), ls, proc)?; + v.end_walk().map_err(|_| anyhow!("failed to emit leaves")) } fn emit_entries(