Skip to content

Commit 8a9a1f9

Browse files
lcnrspastorino
andauthored
update conventions (#735)
* update conventions * typo Co-authored-by: Santiago Pastorino <spastorino@gmail.com> Co-authored-by: Santiago Pastorino <spastorino@gmail.com>
1 parent 8c8130e commit 8a9a1f9

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/conventions.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ chapter covers [formatting](#formatting), [coding for correctness](#cc),
77

88
# Formatting and the tidy script
99

10-
rustc is slowly moving towards the [Rust standard coding style][fmt];
11-
at the moment, however, it follows a rather more *chaotic* style. We
12-
do have some mandatory formatting conventions, which are automatically
13-
enforced by a script we affectionately call the "tidy" script. The
14-
tidy script runs automatically when you do `./x.py test` and can be run
10+
rustc is moving towards the [Rust standard coding style][fmt].
11+
This is enforced by the "tidy" script and can be mostly
12+
automated using `./x.py fmt`.
13+
14+
As the output of [rustfmt] is not completely stable,
15+
formatting this repository using `cargo fmt` is not recommended.
16+
17+
The tidy script runs automatically when you do `./x.py test` and can be run
1518
in isolation with `./x.py test tidy`.
1619

1720
[fmt]: https://github.com/rust-dev-tools/fmt-rfcs
21+
[rustfmt]:https://github.com/rust-lang/rustfmt
1822

1923
<a name="copyright"></a>
2024

@@ -114,12 +118,9 @@ you introduce some code following one strategy, then change it
114118
dramatically (versus adding to it) in a later commit, that
115119
'back-and-forth' can be confusing.
116120

117-
**Only run rustfmt on new content.** One day, we might enforce formatting
118-
for the rust-lang/rust repo. Meanwhile, we prefer that rustfmt not be run
119-
on existing code as that will generate large diffs and will make git blame
120-
harder to sift through. However, running `rustfmt` on new content, e.g. a
121-
new file or a largely new part of a file is ok. Small formatting adjustments
122-
nearby code you are already changing for other purposes are also ok.
121+
**Format liberally.** While only the final commit of a PR must be correctly
122+
formatted, it is both easier to review and less noisy to format each commit
123+
individually using `./x.py fmt`.
123124

124125
**No merges.** We do not allow merge commits into our history, other
125126
than those by bors. If you get a merge conflict, rebase instead via a

0 commit comments

Comments
 (0)