Skip to content

Commit 0dbd331

Browse files
committed
content: Add thoughts about Rust code formatting
This is from the works of [firecracker](https://github.com/firecracker-microvm/firecracker/), by analyzing how they format Rust code. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
1 parent e4312a5 commit 0dbd331

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# How Firecracker Format Their Rust Code
2+
3+
Like most Rust projects,
4+
[Firecracker](https://github.com/firecracker-microvm/firecracker/) uses
5+
`cargo fmt` (namely `rustfmt`) to format Rust code.
6+
7+
This rule is applied bu executing the `pre-commit` shell script, and enforced in
8+
their CI.
9+
10+
## pre-commit Script
11+
12+
This script lints every staged file, as of `.rs`s, it apply `cargo fmt` on them.
13+
The command directly formats that file instead of produce differences
14+
before/after format.

0 commit comments

Comments
 (0)