If no order on the key is enforced in ToString, the following tree:
foo = 1
bar = "baz"
foobar = true
[qux]
foo = 1
bar = "baz"
may come out as:
bar = "baz"
foobar = true
[qux]
foo = 1
bar = "baz"
foo = 1
which is incorrect, since putting that back to the parser would panic
because of a duplicated key (qux.foo). Those changes make sure that
leaf values come before tables in the ToString output.