Skip to content

Commit f7d4d8c

Browse files
authored
Set rustfmt edition and style_edition for consistency (#2525)
Before, running `rustfmt` on an individual file (eg. via an editor plugin) would sometimes produce different formatting than running `cargo fmt` on the whole workspace. That seems to be because `cargo fmt` infers the `edition` and `style_edition` from Cargo.toml, but `rustfmt` needs them to be set explicitly in .rustfmt.toml. Here's a specific formatting difference in case anyone's curious or wants to test it. `rustfmt` (before this PR): ``` use foo::{a::C, B}; ``` `cargo fmt` (always), and `rustfmt` (after this PR): ``` use foo::{B, a::C}; ``` So to be clear, this PR does not change the output of `cargo fmt`. The only downside I know of is that if we bump the edition of the crates, we'll need to remember to bump it in .rustfmt.toml too.
1 parent c6dbcaf commit f7d4d8c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

.rustfmt.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
max_width = 80
2+
edition = "2024"
3+
style_edition = "2024"

0 commit comments

Comments
 (0)