Skip to content

Support partially formatting method chains#6862

Open
randomPoison wants to merge 17 commits intorust-lang:mainfrom
randomPoison:issue-4053-file-lines-multi-line-statements
Open

Support partially formatting method chains#6862
randomPoison wants to merge 17 commits intorust-lang:mainfrom
randomPoison:issue-4053-file-lines-multi-line-statements

Conversation

@randomPoison
Copy link
Copy Markdown
Contributor

Support formatting method chains when only part of the chain is selected with --file-lines, ensuring that only the selected parts of the chain are modified. Partially addresses #4053.

To support this I had to define how chains should be formatted when only part of the chain is selected, since short chains want to be formatted into a single line but we can't do so if only part of the chain was selected. I've opted to have partially-selected chains always be formatted as multi-line chains (i.e. one call in the chain per line, as is the case for long method chains), even if the chain as a whole would be short enough to fit in one line. This means we sometimes get different formatting when formatting the chain as a whole vs formatting only part of the chain, but that seems like the only reasonable approach to take and aligns with the desired formatting described in #4053.

Commit history isn't clean, let me know if I should squash this before it can be merged.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Apr 14, 2026
@ytmimi ytmimi self-assigned this Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants