Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
benediktsatalia opened this issue Oct 31, 2024 · 0 comments
Open

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

benediktsatalia opened this issue Oct 31, 2024 · 0 comments
Labels
e-max width error[internal]: line formatted, but exceeded maximum width poor-formatting

Comments

@benediktsatalia
Copy link

benediktsatalia commented Oct 31, 2024

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.

@ytmimi ytmimi added poor-formatting e-max width error[internal]: line formatted, but exceeded maximum width labels Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e-max width error[internal]: line formatted, but exceeded maximum width poor-formatting
Projects
None yet
Development

No branches or pull requests

2 participants