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.
This commit is contained in:
Cliff L. Biffle 2022-07-22 08:00:54 -07:00 committed by GitHub
parent 901fe3fd7b
commit bbc5e4e6a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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)?;