Skip to content

Commit 474de49

Browse files
committed
Clarify handling of edition in rustfmt vs cargo fmt
1 parent a64b7e8 commit 474de49

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

text/0000-style-evolution.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ style. The default Rust style varies by Rust edition. (Not every edition
3636
changes the Rust style, and thus some editions have identical default styles;
3737
Rust 2015, 2018, and 2021 all have the same default style.)
3838

39-
By default, `rustfmt` and `cargo fmt` will use the same edition that the Rust
40-
code itself is configured to use. `cargo fmt` will pass `rustfmt` the edition
41-
specified in `Cargo.toml`; for direct invocation of `rustfmt`,
42-
`rustfmt.toml`/`.rustfmt.toml` can also specify the `edition`.
39+
Direct invocations of `rustfmt` obtain the edition used for parsing Rust code
40+
from the `edition` option in its configuration file (`rustfmt.toml` or
41+
`.rustfmt.toml`), or via the `--edition` command-line option; `cargo fmt`
42+
obtains the edition from the `edition` option in `Cargo.toml` and passes it to
43+
`rustfmt`. By default, `rustfmt` and `cargo fmt` will use the same edition for
44+
style as the Rust edition used for parsing.
4345

4446
However, when transitioning between editions, projects may want to separately
4547
make and commit the changes for 1) transitioning to a new Rust edition and 2)

0 commit comments

Comments
 (0)