Skip to content

Too long line for function parameter of type impl Trait #6381

Open
@benediktsatalia

Description

@benediktsatalia

Consider the following function:

fn my_function(
    my_long_impl_trait_parameter: impl Into<MyVeryLongTypeNameThatMakesThisWholeLineOverThe100CharLimit>,
) {
}

The parameter line is too long (105 chars) but rustfmt does not change it, it even reformats to this if we try to fix it manually.

Interestingly, if we add one more character then it breaks correctly:

fn my_function(
    my_long_impl_trait_parameter: impl Into<
        MyVeryLongTypeNameThatMakesThisWholeLineOverThe100CharLimitA,
    >,
) {
}

(I have chosen the example in the extreme case on purpose)

Also if we remove the impl and replace Into with some struct name it correctly formats again. So I think it has to do with the impl , but this is just a wild guess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    e-max widtherror[internal]: line formatted, but exceeded maximum widthpoor-formatting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions