@@ -7,14 +7,18 @@ chapter covers [formatting](#formatting), [coding for correctness](#cc),
7
7
8
8
# Formatting and the tidy script
9
9
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
15
18
in isolation with ` ./x.py test tidy ` .
16
19
17
20
[ fmt ] : https://github.com/rust-dev-tools/fmt-rfcs
21
+ [ rustfmt ] :https://github.com/rust-lang/rustfmt
18
22
19
23
<a name =" copyright " ></a >
20
24
@@ -114,12 +118,9 @@ you introduce some code following one strategy, then change it
114
118
dramatically (versus adding to it) in a later commit, that
115
119
'back-and-forth' can be confusing.
116
120
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 ` .
123
124
124
125
** No merges.** We do not allow merge commits into our history, other
125
126
than those by bors. If you get a merge conflict, rebase instead via a
0 commit comments