Unexpected arrow indent change in trait methods with Rust edition 2024
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
With the following code:
trait Foo {
fn fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(_: ())
-> u32;
}
The -> is indented with 4 spaces after fn with edition 2021, but with edition 2024, rustfmt will align -> with fn:
trait Foo {
fn fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo(_: ())
-> u32;
}
Here is a playground link for this: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9cb2cfab404be994870455658edba6e0.
Is this change intended?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Rust Playground reproduction and compare rustfmt output for editions 2021 and 2024. Trace the formatting behavior for long trait method signatures and determine whether the edition-dependent arrow indentation is intentional; done means the expected behavior is decided and the issue has a corresponding regression test or documented resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100