cargo-sort icon indicating copy to clipboard operation
cargo-sort copied to clipboard

Reordering of sections doesn't add a new line between them

Open palfrey opened this issue 3 years ago • 3 comments

With Cargo.toml as

[dependencies]
amq-protocol = "6"
anyhow = "1"
bytes = "1"
diesel = { version = "1.4", features = ["postgres"] }
dotenv = "0.15.0"
lazy_static = "1"
regex = "1"
serde = "1"
tokio = {version="1", features=["net", "io-util", "rt", "macros", "rt-multi-thread"] }

[dev-dependencies]
celery = "0.4.0-rcn.11"
simplelog = "*"

[package]
edition = "2021"
name = "cavalcade"
version = "0.1.0"

and tomlfmt.toml as

table_order = ["package", "dependencies", "dev-dependencies"]

it gets reordered to


[package]
edition = "2021"
name = "cavalcade"
version = "0.1.0"
[dependencies]
amq-protocol = "6"
anyhow = "1"
bytes = "1"
diesel = { version = "1.4", features = ["postgres"] }
dotenv = "0.15.0"
lazy_static = "1"
regex = "1"
serde = "1"
tokio = { version = "1", features = ["net", "io-util", "rt", "macros", "rt-multi-thread"] }

[dev-dependencies]
celery = "0.4.0-rcn.11"
simplelog = "*"

Note the newline at the top of the file, and the lack of newline before dependencies

palfrey avatar Jan 02 '22 18:01 palfrey

Fixing this manually is easy and the tool is happy after that, so thanks for making it though!

palfrey avatar Jan 02 '22 18:01 palfrey

Thanks for catching this, it may be easy to fix but it should work :smile:

I'll look into it unless you are interested?

DevinR528 avatar Jan 02 '22 22:01 DevinR528

I'm unlikely to pick this up any time soon as I've got too many other things on my plate currently.

palfrey avatar Jan 02 '22 23:01 palfrey