Skip to content

Correct newline-style in json emitter#5418

Open
davidBar-On wants to merge 2 commits into
rust-lang:mainfrom
davidBar-On:issue-4273-incorrect-newline-style-in-json-emitter
Open

Correct newline-style in json emitter#5418
davidBar-On wants to merge 2 commits into
rust-lang:mainfrom
davidBar-On:issue-4273-incorrect-newline-style-in-json-emitter

Conversation

@davidBar-On
Copy link
Copy Markdown
Contributor

Suggested fix for issue #4273 - using the configured newline_style for the emitted JSON expected parts. The PR is based on back-porting PR #4743 (that was not merged into R2).

The approach taken is to propagate the newline-style setting by adding emit_formatted_file_with_line_style() function to the Emitter trait, and changing the default emit_formatted_file() to call it. All emit_formatted_file implementation were changed to emit_formatted_file_with_line_style, but the relevant code still calls emit_formatted_file. This is except for the JsonEmitter that calls emit_formatted_file_with_line_style directly with the newline-style setting, and the function is using it for the emitted expected parts.

Based on a comment to PR #4743, testings were added to writemode, to allow using test files.

Comment thread src/formatting/newline_style.rs
Comment thread src/formatting/newline_style.rs Outdated
Comment thread src/formatting/newline_style.rs Outdated
@ytmimi ytmimi mentioned this pull request Jul 12, 2022
@ytmimi ytmimi added the P-low Low priority label Jul 28, 2022
@jieyouxu jieyouxu added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Feb 23, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 13, 2026

☔ The latest upstream changes (possibly #6823) made this pull request unmergeable. Please resolve the merge conflicts.

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

Labels

P-low Low priority pr-follow-up-review-pending 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.

4 participants