Skip to content

Add rustfmt.toml#14072

Merged
BurntSushi merged 1 commit intomainfrom
ag/rustfmt
Jun 16, 2025
Merged

Add rustfmt.toml#14072
BurntSushi merged 1 commit intomainfrom
ag/rustfmt

Conversation

@BurntSushi
Copy link
Member

We've gotten away without this file for a while. In particular, we
explicitly use its default settings.

However, this is occasionally problematic in certain contexts where
rustfmt is invoked directly. Or in contexts where the Rust Edition is
otherwise not specified. At least, this happens when using the Rust vim
plugin. When an edition isn't explicitly specified, it defaults back to
the 2015 edition.

I think that there aren't a lot of rustfmt changes, and so we've been
able to get away with this for a while. But it looks like something in
the 2024 edition changes how imports are ordered. So to make it explicit
that we want to use the 2024 edition of rustfmt, we opt into it.

This is analogous to a change made to the Ruff repository somewhat
recently: astral-sh/ruff#18197

We've gotten away without this file for a while. In particular, we
explicitly use its default settings.

However, this is occasionally problematic in certain contexts where
`rustfmt` is invoked directly. Or in contexts where the Rust Edition is
otherwise not specified. At least, this happens when using the Rust vim
plugin. When an edition isn't explicitly specified, it defaults back to
the 2015 edition.

I think that there aren't a lot of rustfmt changes, and so we've been
able to get away with this for a while. But it looks like something in
the 2024 edition changes how imports are ordered. So to make it explicit
that we want to use the 2024 edition of rustfmt, we opt into it.

This is analogous to a change made to the Ruff repository somewhat
recently: astral-sh/ruff#18197
@zanieb zanieb added the internal A refactor or improvement that is not user-facing label Jun 16, 2025
@BurntSushi BurntSushi merged commit 5c1ebf9 into main Jun 16, 2025
86 checks passed
@BurntSushi BurntSushi deleted the ag/rustfmt branch June 16, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants