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

Add an option not to insert a space between nested tuple access #4779

Open
TonalidadeHidrica opened this issue Apr 1, 2021 · 3 comments
Open

Comments

@TonalidadeHidrica
Copy link

TonalidadeHidrica commented Apr 1, 2021

📋 Description

Current formatter inserts a space between nested tuple access, as introduced in #1609. As of Rust 1.46.0, we do no longer need such spaces (or parenthesis) for such syntax, thanks to rust-lang/rust#71322. Therefore, we want an option not to insert a space between nested tuple access.

@calebcartwright
Copy link
Member

hi thanks for reaching out with the suggestion.

We're quite familiar with the nested tuple changes in the compiler, but there's some additional pertinent context here which I'd summarized back in #4355 (comment).

TL;DR the rules that govern rustfmt prevent us from making such a change by default. If you have the option of setting version to Two in your rustfmt then you can go ahead and get the desired formatting, but that's the only option available today.

I'm planning to try to push a request through to allow us to make the "breaking" change to address nested tuple spacing issue because frankly it just seems silly that we continue to format with the spacing indefinitely just because once upon a time it was necessary.

Adding a standalone configuration option is an interesting suggestion, but I'm not too keen on it because it feels like another hack, and long term like it could cause more trouble than it'd be worth (e.g. having to maintain the code/docs/etc. for an option that would allow folks to opt into that weird spacing).

I will keep this issue open for now, and if the request to update the default formatting ends up getting rejected then I will certainly reconsider this!

@nhamovitz
Copy link

nhamovitz commented Nov 18, 2021

Hi - just adding my 2c —
I ran into this and was so taken aback that I came here to report a bug. Having read just now through all the historical context, I totally understand why the current behavior exists, but imho this change should absolutely be made if possible.

Edit: oh, I didn't realize when I wrote the above that the change indeed had/has been made in v2. Probably I personally would still vote for backporting, but waiting until we can do the breaking change w/ semver is totally reasonable.

@lilyball
Copy link

@calebcartwright

I will keep this issue open for now, and if the request to update the default formatting ends up getting rejected then I will certainly reconsider this!

Any update on this? It's been almost a year since that comment, and version = "Two" is still unstable so I can't use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants