From c961d78f209005db4200fdb5567d43e01be05a6e Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 26 Nov 2020 23:12:35 +0100 Subject: Simplify output of node info. With the Node Enum, we don't need to unwrap the contents just for s debug printout. --- src/main.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 802d50e..6a1c37d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -356,15 +356,9 @@ where assert_eq!(r.len(), 0); let mut indent = 2; for node in nodes { - match node { - Node::Container(name, v) => { - println!("{1:0$}{2}, {3}", indent, " ", name, v); - indent += 2; - }, - Node::Leaf(name, v, nv) => { - println!("{1:0$}{2}, {3}", indent, " ", name, v); - println!("{1:0$}{2:?}", indent + 2, " ", nv); - }, + println!("{1:0$}{2:?}", indent, " ", node); + if let Node::Container(_, _) = node { + indent += 2; } } }, -- cgit v1.2.3