From bbc5e4e6a6ca5f9178a03505f025b5e388e8adcc Mon Sep 17 00:00:00 2001 From: "Cliff L. Biffle" Date: Fri, 22 Jul 2022 08:00:54 -0700 Subject: [PATCH] fix(fmt): Indent trailing brace of nested nodes. (#49) In 4.3.0, the Display output for nested nodes always puts the trailing braces on the left margin: a { b { c { } } } This commit indents the trailing brace to match the node name, at least when explicit trailing text is not provided. --- src/node.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.rs b/src/node.rs index 1e15fef..302e715 100644 --- a/src/node.rs +++ b/src/node.rs @@ -513,7 +513,7 @@ impl KdlNode { writeln!(f)?; } children.stringify(f, indent + 4)?; - write!(f, "}}")?; + write!(f, "{:indent$}}}", "", indent = indent)?; } if let Some(trailing) = &self.trailing { write!(f, "{}", trailing)?;