Skip to content

Unexpected arrow indent change in trait methods with Rust edition 2024 #6482

Open
@EFanZh

Description

@EFanZh

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions