Skip to content

Commit

Permalink
add manifest formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
the-right-joyce committed Aug 26, 2023
1 parent 6bb7d19 commit 6e4d421
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,26 @@ let mut target_path =
- how likely is it that invariants could be violated,
- are issues stemming from the use of unsafe code caught by existing tests/tooling,
- what are the consequences if the problems slip into production.

# Manifest Formatting

> **TLDR**
> You can use the CLI tool [Zepter](https://crates.io/crates/zepter) to format the files: `zepter format features`
Rust `Cargo.toml` files need to respect certain formatting rules. All entries need to be alphabetically sorted. This makes it easier to read them and insert new entries. The exhaustive list of rules is enforced by the CI. The general format looks like this:

- The feature is written as a single line if it fits within 80 chars:
```toml
[features]
default = [ "std" ]
```

- Otherwise the feature is broken down into multiple lines with one entry per line. Each line is padded with one tab and no trailing spaces but a trailing comma.
```toml
[features]
default = [
"loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
# Comments go here as well ;)
"std",
]
```

0 comments on commit 6e4d421

Please sign in to comment.