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

Regression of indentation of single-expression control flow in match arms #2627

Closed
shepmaster opened this issue Apr 16, 2018 · 2 comments
Closed

Comments

@shepmaster
Copy link
Member

As of PR #1877, I expect this to remain unchanged:

fn main() {
    match 1 {
        a => {
            match a {
                1 => 1,
                2 => 2,
                x => x,
            }
        },
    }
}

I recall this working for a while. However, now the match is moved up a line:

fn main() {
    match 1 {
        a => match a {
            1 => 1,
            2 => 2,
            x => x,
        },
    }
}

I see this behavior with:

  • 0.3.8-nightly (346238f 2018-02-04)
  • rustfmt 0.4.2-nightly (1415a4d 2018-04-14)
@nrc
Copy link
Member

nrc commented Jun 22, 2018

This is intentional as part of the 'combining expressions' section of the RFC.

@nrc nrc closed this as completed Jun 22, 2018
@shepmaster
Copy link
Member Author

Thank you.

As you might imagine, I strongly disagree with this particular style aspect. It appears that force_multiline_blocks = true uses the style that I'd prefer; do you happen to know if that will have unexpected effects beyond this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants