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

rustfmt doesn't format struct constructor with long string literal #4992

Closed
kawaemon opened this issue Sep 16, 2021 · 1 comment
Closed

rustfmt doesn't format struct constructor with long string literal #4992

kawaemon opened this issue Sep 16, 2021 · 1 comment

Comments

@kawaemon
Copy link

I'm sorry if this is a duplicated issue!

As title says, rustfmt doesn't format struct constructor with long string literal.

Reproduce

Formatting this code causes this issue. playground

struct Foo {
    text: &'static str,
    data: i32,
}

fn foo() -> Foo {
    Foo{ text: "123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_1234567"
                                   ,data: 4
    }
}

It should be formatted like this:

struct Foo {
    text: &'static str,
    data: i32,
}

fn foo() -> Foo {
    Foo {
        text:
            "123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_1234567",
        data: 4,
    }
}

My rustfmt version: rustfmt 1.4.37-nightly (c3c0f80 2021-09-14)
also reproduceable on Playground(stable).

I don't use custom configurations.

@kawaemon
Copy link
Author

I'm closing this issue because I realized it is duplicate of #4800.

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

1 participant