Skip to content

Commit 4c8ddb6

Browse files
docs: use StyleEdition in dev guide
s
1 parent 845cf93 commit 4c8ddb6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Contributing.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@ If you want to test modified `cargo-fmt`, or run `rustfmt` on the whole project
109109
RUSTFMT="./target/debug/rustfmt" cargo run --bin cargo-fmt -- --manifest-path path/to/project/you/want2test/Cargo.toml
110110
```
111111

112-
### Version-gate formatting changes
112+
### Gate formatting changes
113113

114-
A change that introduces a different code-formatting should be gated on the
115-
`version` configuration. This is to ensure the formatting of the current major
116-
release is preserved, while allowing fixes to be implemented for the next
117-
release.
114+
A change that introduces a different code-formatting must be gated on the
115+
`style_edition` configuration. This is to ensure rustfmt upholds its formatting
116+
stability guarantees and adheres to the Style Edition process set in [RFC 3338]
118117

119-
This is done by conditionally guarding the change like so:
118+
This can be done by conditionally guarding the formatting change, e.g.:
120119

121120
```rust
122-
if config.version() == Version::One { // if the current major release is 1.x
121+
// if the current stable Style Edition is Edition 2024
122+
if config.style_edition() <= StyleEdition::Edition2024 {
123123
// current formatting
124124
} else {
125125
// new formatting
@@ -129,13 +129,14 @@ if config.version() == Version::One { // if the current major release is 1.x
129129
This allows the user to apply the next formatting explicitly via the
130130
configuration, while being stable by default.
131131

132-
When the next major release is done, the code block of the previous formatting
133-
can be deleted, e.g., the first block in the example above when going from `1.x`
134-
to `2.x`.
132+
This can then be enhanced as needed if and when there are
133+
new Style Editions with differing formatting prescriptions.
135134

136135
| Note: Only formatting changes with default options need to be gated. |
137136
| --- |
138137

138+
[RFC 3338]: https://rust-lang.github.io/rfcs/3338-style-evolution.html
139+
139140
### A quick tour of Rustfmt
140141

141142
Rustfmt is basically a pretty printer - that is, its mode of operation is to

0 commit comments

Comments
 (0)