Skip to content

weird spacing in multi line access to nested tuples #6249

Closed as not planned
Closed as not planned
@m4rch3n1ng

Description

@m4rch3n1ng

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");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed-with-v2The issue is resolved by setting `version = "Two"` in your projects rustfmt.toml

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions