-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document Cargo.toml formatting #528
Comments
I found some kind of style guide (for reference): https://github.com/rust-lang/rust/blob/master/src/doc/style-guide/src/cargo.md Eg:
So [package]
name = "crate-name"
version = "0.0.1"
# ... otherwise alphabetically sorted here
description = "this crate does nothing" |
It looks like many organizations/projects have the same conundrum. There also seems to be some work underway to bring the formatting into rustfmt: rust-lang/rustfmt#5240 Maybe we just need to wait it out? |
I think we can throw a link to https://github.com/rust-lang/rust/blob/master/src/doc/style-guide/src/cargo.md in our guidelines and call it a day until we got rustfmt support, WDYT? |
FYI, just saw apache/iceberg-rust#167 |
I'm working on this now: #535 @sbernauer taplo looks interesting but I think we can just wait until it'll be native in rustfmt, not worth the effort to add another tool to our build process. If you think it's worth investigating maybe track it in a new issue. |
100% agreed |
It is good to have consistent formatting for consistency between developers (eg: using rustfmt for ust code) to reduce noise around style in PR reviews.
Automatic formatting is a preference, however exising TOML formatters (as far as we know) apply rules across the whole toml file (and not only Cargo.toml), rather than different rules per section or use case of toml.
For example,
[dependencies]
to be ordered alphabetically[project]
attributes to be at the top of the sectionSo, for now we should document how we expect Cargo.toml to look, to avoid it repeatedly coming up in PRs.
The text was updated successfully, but these errors were encountered: