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

Visual ident style of if in closure is wrong #3634

Open
davidMcneil opened this issue Jun 18, 2019 · 2 comments
Open

Visual ident style of if in closure is wrong #3634

davidMcneil opened this issue Jun 18, 2019 · 2 comments
Labels
a-chains a-closures only-with-option requires a non-default option value to reproduce p-low poor-formatting

Comments

@davidMcneil
Copy link

This

fn test() {
    let aaaaaaaaaaaaaaaa = ffffffffffffffffffffffff
        .iter()
        .filter_map(|_| {
            if bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                == ccccccccccccccccccccccc
                    .dddddddddddddddddddddddd()
                    .eeeeeeeeeeeeeeeeeeeeee()
            {
                ();
            }
        })
        .collect();
}

is turned into this

fn test() {
    let aaaaaaaaaaaaaaaa = ffffffffffffffffffffffff.iter()
                                                   .filter_map(|_| {
                                                       if bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                == ccccccccccccccccccccccc
                    .dddddddddddddddddddddddd()
                    .eeeeeeeeeeeeeeeeeeeeee()
            {
                ();
            }
                                                   })
                                                   .collect();
}
@YaLTeR
Copy link
Contributor

YaLTeR commented Jul 3, 2019

This is probably just rustfmt not reformatting lines which it can't fit into the line length limit.

@topecongiro topecongiro added only-with-option requires a non-default option value to reproduce p-low labels Jun 29, 2020
@ytmimi
Copy link
Contributor

ytmimi commented Jul 20, 2022

Confirming I can reproduce this with rustfmt 1.5.1-nightly (f2c31ba0 2022-07-19) when setting indent_style=Visual.

Input

fn test() {
    let aaaaaaaaaaaaaaaa = ffffffffffffffffffffffff
        .iter()
        .filter_map(|_| {
            if bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                == ccccccccccccccccccccccc
                    .dddddddddddddddddddddddd()
                    .eeeeeeeeeeeeeeeeeeeeee()
            {
                ();
            }
        })
        .collect();
}

Output

fn test() {
    let aaaaaaaaaaaaaaaa = ffffffffffffffffffffffff.iter()
                                                   .filter_map(|_| {
                                                       if bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                == ccccccccccccccccccccccc
                    .dddddddddddddddddddddddd()
                    .eeeeeeeeeeeeeeeeeeeeee()
            {
                ();
            }
                                                   })
                                                   .collect();
}

Linking the 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
a-chains a-closures only-with-option requires a non-default option value to reproduce p-low poor-formatting
Projects
None yet
Development

No branches or pull requests

5 participants