Skip to content

weird spacing in multi line access to nested tuples #6249

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
m4rch3n1ng opened this issue Jul 22, 2024 · 1 comment
Closed

weird spacing in multi line access to nested tuples #6249

m4rch3n1ng opened this issue Jul 22, 2024 · 1 comment
Labels
fixed-with-v2 The issue is resolved by setting `version = "Two"` in your projects rustfmt.toml

Comments

@m4rch3n1ng
Copy link

m4rch3n1ng commented Jul 22, 2024

i know that due to #1063 one.0.1 is formatted as one.0 .1, so that the 0.1 doesn't get interpreted as a float literal.

but if the next lines are long enough that the 0.1 gets put onto the next line, then that should not be affected by the bug in #1063, and could be formatted like expected.

this gets fixed by adding version = "Two", but as far as i can tell could be fixed with version = "One" as well.

struct One(Two);

impl One {
	fn new() -> Self {
		One(Two((), Three))
	}
}

struct Two((), Three);

struct Three;

impl Three {
	fn test(&self, _: &str) -> bool {
		true
	}
}

fn main() {
	let one = One::new();
	let _ = one.0 .1; // this is due to https://github.com/rust-lang/rustfmt/issues/1063
	let _ = one
		.0
		 .1 // this shouldn't be affected by that and just looks very bad
		.test("really really long string so that it wraps to the next line");
}
@ytmimi ytmimi added the fixed-with-v2 The issue is resolved by setting `version = "Two"` in your projects rustfmt.toml label Jul 22, 2024
@ytmimi
Copy link
Contributor

ytmimi commented Jul 22, 2024

Thanks for the report and for double checking that this is resolved when setting version=Two. I've also confirmed that setting version=Two resolves the issue locally so there's nothing left to do. rustfmt's strong stability guarantee means we can't fix this for version=One.

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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