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

Last parameter in function signature misaligned #4352

Open
calebcartwright opened this issue Jul 26, 2020 · 1 comment
Open

Last parameter in function signature misaligned #4352

calebcartwright opened this issue Jul 26, 2020 · 1 comment
Assignees
Labels
only-with-option requires a non-default option value to reproduce poor-formatting

Comments

@calebcartwright
Copy link
Member

calebcartwright commented Jul 26, 2020

When using Visual indent style and formatting a multi-lined function signature with the first line exceeding max_width, the last parameter will be formatted with incorrect indentation

Input

rustfmt.toml

indent_style = "Visual"
# This can be anything, just using a shorter value than the default for an easier example
max_width = 30
fn exceeds_max_width_1<T: Foo>(
    a: T,
    b: u32,
    c: u32){
   
}

Output

fn exceeds_max_width_1<T: Foo>(
    a: T,
    b: u32,
c: u32){
    // ...
}

Expected output
Believe it should be something like the below, but either way the indentation of the c parameter is definitely off currently

fn exceeds_max_width_1<
    T: Foo,
>(
    a: T,
    b: u32,
    c: u32,
){
    // ...
}

Meta

  • rustfmt version: Can reproduce this with 1.4.19 and latest 2.0 version on master
  • From where did you install rustfmt?: Tested building from source as well as via rustup on nightly
@calebcartwright calebcartwright added the only-with-option requires a non-default option value to reproduce label Jul 26, 2020
@ytmimi
Copy link
Contributor

ytmimi commented Jul 26, 2022

confirming this is still reproducible with rustfmt 1.5.1-nightly (a451a39d 2022-07-25).

Linking tracking issue for indent_style #3346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
only-with-option requires a non-default option value to reproduce poor-formatting
Projects
None yet
Development

No branches or pull requests

3 participants