Skip to content

Allow streaming formatting#6957

Open
mansiverma897993 wants to merge 3 commits into
rust-lang:mainfrom
mansiverma897993:streaming-formatting
Open

Allow streaming formatting#6957
mansiverma897993 wants to merge 3 commits into
rust-lang:mainfrom
mansiverma897993:streaming-formatting

Conversation

@mansiverma897993

Copy link
Copy Markdown

This PR implements streaming formatting via the --start-marker and --end-marker command-line options.

When both options are supplied, rustfmt reads from stdin streamingly, and detects blocks of Rust code enclosed by the start and end markers. Each block is formatted using the standard format_string mechanism and flushed to stdout immediately, followed by the end marker. This avoids the 30ms startup overhead on Windows for tools invoking rustfmt repeatedly.

An integration test is also included in tests/rustfmt/main.rs to verify the functionality.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Jul 12, 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.

2 participants