Skip to content

Weird spacing with nested tuples #5745

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

Closed
pommicket opened this issue Apr 9, 2023 · 2 comments
Closed

Weird spacing with nested tuples #5745

pommicket opened this issue Apr 9, 2023 · 2 comments
Labels
duplicate fixed-with-v2 The issue is resolved by setting `version = "Two"` in your projects rustfmt.toml

Comments

@pommicket
Copy link

This code:

fn main() {
    let x = ((0, 1), 2);
    println!("{}", x.0.0);
}

Gets formatted to:

fn main() {
    let x = ((0, 1), 2);
    println!("{}", x.0 .0);
}

This was intentional since apparently x.0.0 used to get parsed as x.(0.0) (see #1063). But the version without the space compiles now, so maybe rustfmt shouldn't add the space anymore?

@ytmimi
Copy link
Contributor

ytmimi commented Apr 9, 2023

Thanks for reaching out. This is a duplicate of #5532

This is fixed when setting version=Two. See #4355 (comment) for more details.

@ytmimi ytmimi added duplicate fixed-with-v2 The issue is resolved by setting `version = "Two"` in your projects rustfmt.toml labels Apr 9, 2023
@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2023
@ytmimi
Copy link
Contributor

ytmimi commented Apr 9, 2023

I'll also note that because of our stance on breaking formatting changes we haven't fixed this on version=One, and you'll need to use version=Two to get the formatting that you want, but you'll need a nightly version of rustfmt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate fixed-with-v2 The issue is resolved by setting `version = "Two"` in your projects rustfmt.toml
Projects
None yet
Development

No branches or pull requests

2 participants