Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style evolution #3338

Merged
merged 13 commits into from
Dec 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarify handling of edition in rustfmt vs cargo fmt
  • Loading branch information
joshtriplett committed Oct 27, 2022
commit 474de4987c886fd1ca6deb6bcc71d80455e236b5
10 changes: 6 additions & 4 deletions text/0000-style-evolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ style. The default Rust style varies by Rust edition. (Not every edition
changes the Rust style, and thus some editions have identical default styles;
Rust 2015, 2018, and 2021 all have the same default style.)

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

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