Skip to content

Set rustfmt edition and style_edition for consistency#716

Open
evan-oxide wants to merge 1 commit into
masterfrom
evan/rustfmt-edition
Open

Set rustfmt edition and style_edition for consistency#716
evan-oxide wants to merge 1 commit into
masterfrom
evan/rustfmt-edition

Conversation

@evan-oxide

@evan-oxide evan-oxide commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This is equivalent to this hubris PR: oxidecomputer/hubris#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 workspace, we'll need to remember to bump it in .rustfmt.toml too.

@evan-oxide
evan-oxide requested a review from labbott July 16, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant