From 3dfdcdb5360bf92d200ad1d24c14e09b52447b2d Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Wed, 15 May 2024 05:20:26 +0100 Subject: [PATCH] Fix TOML array formatting (#1084) Closes #1083 A trailing newline is only added if there are dependencies or comments in the array. --- rye/src/utils/toml.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rye/src/utils/toml.rs b/rye/src/utils/toml.rs index b38f5351ff..48fc655ecb 100644 --- a/rye/src/utils/toml.rs +++ b/rye/src/utils/toml.rs @@ -48,7 +48,9 @@ pub fn reformat_array_multiline(deps: &mut Array) { rv.push_str(comment); } } - rv.push('\n'); + if !rv.is_empty() || !deps.is_empty() { + rv.push('\n'); + } rv }); deps.set_trailing_comma(true);