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

array pattern formatting does not honour column limit #6145

Closed
nagisa opened this issue Apr 11, 2024 · 3 comments
Closed

array pattern formatting does not honour column limit #6145

nagisa opened this issue Apr 11, 2024 · 3 comments
Labels
fixed-with-v2 The issue is resolved by setting `version = "Two"` in your projects rustfmt.toml

Comments

@nagisa
Copy link
Member

nagisa commented Apr 11, 2024

Consider following code:

fn main() {
    let [
        mut insert_count, 
        mut set_count, 
        mut update_rc_count, 
        mut delete_count, 
        mut delete_all_count, 
        mut delete_range_count
    ] = [0u64; 6];
}

playground

Rustfmt will put the whole pattern on a single line, even though it well exceeds the 100 columns rustfmt should target.

@ytmimi
Copy link
Contributor

ytmimi commented Apr 11, 2024

@ytmimi ytmimi added the fixed-with-v2 The issue is resolved by setting `version = "Two"` in your projects rustfmt.toml label Apr 11, 2024
@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2024
@nagisa
Copy link
Member Author

nagisa commented Apr 13, 2024

One thing I'm missing in the referenced issue is why Version=Two scheme was necessitated? Is there a writeup on this somewhere? Could that be linked from a message (ideally the first one) in the referenced issue?

@ytmimi
Copy link
Contributor

ytmimi commented Apr 13, 2024

@nagisa I tracked this down to #4994, and we needed version=Two because it would have been a breaking change to introduce this to all users at the time. See #4994 (comment). It's almost always the case that when version=Two is needed to introduce a formatting fix it's to avoid breaking stable formatting.

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