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

Poor TAIT formatting with version = "Two": + line breaks are not block indented #5027

Closed
chitoyuu opened this issue Oct 14, 2021 · 4 comments · Fixed by #5093
Closed

Poor TAIT formatting with version = "Two": + line breaks are not block indented #5027

chitoyuu opened this issue Oct 14, 2021 · 4 comments · Fixed by #5093
Labels
help wanted only-with-option requires a non-default option value to reproduce poor-formatting

Comments

@chitoyuu
Copy link

chitoyuu commented Oct 14, 2021

Currently on 1.4.37-nightly (dfc5add 2021-10-13), with version = "Two" and all other options left at default, this:

pub type Iter<'a, D> = impl DoubleEndedIterator<Item = (SomethingSomethingSomethingLongType<D>)> + ExactSizeIterator + 'a;

is formatted to:

pub type Iter<'a, D> = impl DoubleEndedIterator<Item = (SomethingSomethingSomethingLongType<D>)>
+ ExactSizeIterator
+ 'a;

...whereas on stable, the same code is formatted to the more familiar and (subjectively) more pleasing:

pub type Iter<'a, D> = impl DoubleEndedIterator<Item = (SomethingSomethingSomethingLongType<D>)>
    + ExactSizeIterator
    + 'a;

...with block indentation for the broken lines.

@calebcartwright
Copy link
Member

I can't reproduce this with default behavior, and have to change the default value of the version config option to Two in order to reproduce.

That is of course something we need to fix, but I need to get some clarity on whether this can actually be produced with all defaults. Can you share your rustfmt config file, and/or share output from running rustfmt in verbose mode?

@calebcartwright calebcartwright added only-with-option requires a non-default option value to reproduce poor-formatting labels Oct 16, 2021
@chitoyuu chitoyuu changed the title Poor default TAIT formatting on nightly: + line breaks are not block indented Poor TAIT formatting with version = "Two": + line breaks are not block indented Oct 17, 2021
@chitoyuu
Copy link
Author

chitoyuu commented Oct 17, 2021

I can't reproduce this with default behavior, and have to change the default value of the version config option to Two in order to reproduce.

My bad. My rustfmt.toml is a single line version = "Two". When I said "by default" I was having "version 2 default" in mind. I have updated the issue to mention this. Sorry I didn't make it clear enough the first time.

@calebcartwright
Copy link
Member

No worries, thanks for clarifying!

@karyon
Copy link
Contributor

karyon commented Oct 22, 2021

fwiw, this is the PR/diff that has introduced this: 1643d72#diff-ed12f5ea605f23bb4d26cc65778e3daff9db3eec40e2abfc82beafca130a99a0R751.

#4373 seems related.

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

Successfully merging a pull request may close this issue.

3 participants