Skip to content

Fix first-pass layout of wide table arguments - #1200

Open
Boulea7 wants to merge 1 commit into
JohnnyMorganz:mainfrom
Boulea7:fix/idempotent-table-arguments-1193
Open

Boulea7 wants to merge 1 commit into
JohnnyMorganz:mainfrom
Boulea7:fix/idempotent-table-arguments-1193

Conversation

@Boulea7

@Boulea7 Boulea7 commented Nov 30, 2026

Copy link
Copy Markdown

Fixes #1193.

Use the formatted width of table arguments to choose their layout on the first pass. For the reported call, the opening brace stays with the preceding arguments. Compact tables that exceed the width after spacing is added expand immediately, including when redundant parentheses are removed or the arguments already span multiple lines.

The width prediction follows the approach explored in #1194. The formatter now also uses that decision when it renders the table.

Validation

  • cargo test --locked --all-features
  • cargo fmt --check and cargo clippy --all-features -- -D warnings
  • 2,310 CLI inputs formatted identically on the second pass. All 1,813 layouts that were already stable on main kept the same bytes.

Carry the table expansion decision from function call layout into final formatting. Exercise the reported layout and a compact table whose normalized width exceeds its budget.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatting is not idempotent: a call's last table argument hugs only on the second pass

1 participant