Skip to content

function return type exceeds max width without wrapping #6521

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

Open
jan-ferdinand opened this issue Mar 26, 2025 · 1 comment
Open

function return type exceeds max width without wrapping #6521

jan-ferdinand opened this issue Mar 26, 2025 · 1 comment
Labels
e-max width error[internal]: line formatted, but exceeded maximum width

Comments

@jan-ferdinand
Copy link

rustfmt 1.8.0-stable 2025-03-15 4eb161250e does not reformat the following input, violating the default max_width of 100 characters:

mod tests {
    // 100 characters is ··································································· here: |
    fn a_very_long_function_name_such_as_sometimes_found_in_descriptive_test_fn() -> CustomResultType
    {
        todo!()
    }
}

playground

@ytmimi
Copy link
Contributor

ytmimi commented Mar 26, 2025

There's some type of Shape issue here. If you add one more character to the function name or to the return type, then it wraps:

mod tests {
    // 100 characters is ··································································· here: |
    fn a_very_long_function_name_such_as_sometimes_found_in_descriptive_test_fnn() -> CustomResultType
    {
        todo!()
    }

    // 100 characters is ··································································· here: |
    fn a_very_long_function_name_such_as_sometimes_found_in_descriptive_test_fn() -> CustomResultTypee
    {
        todo!()
    }
}
mod tests {
    // 100 characters is ··································································· here: |
    fn a_very_long_function_name_such_as_sometimes_found_in_descriptive_test_fnn(
    ) -> CustomResultType {
        todo!()
    }

    // 100 characters is ··································································· here: |
    fn a_very_long_function_name_such_as_sometimes_found_in_descriptive_test_fn(
    ) -> CustomResultTypee {
        todo!()
    }
}

@ytmimi ytmimi added the e-max width error[internal]: line formatted, but exceeded maximum width label Mar 26, 2025
@ytmimi ytmimi changed the title Violates max width in some cases function return type exceeds max width without wrapping Mar 26, 2025
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
Projects
None yet
Development

No branches or pull requests

2 participants