As @regexident pointed it out, cargo-tomlfmt removes all comments in Cargo.toml previously.
So I switched the main parser from toml to toml_edit to preserve these comments.
This fix also resolve the #4 error as a side effect.
Thanks for the suggestion @regexident! 👍
Related issue. https://github.com/tbrand/cargo-tomlfmt/issues/5
As @regexident pointed it out, cargo-tomlfmt removes all comments in Cargo.toml previously. So I switched the main parser from toml to toml_edit to preserve these comments.
This fix also resolve the #4 error as a side effect. Thanks for the suggestion @regexident! 👍