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

Fixing new line issue #95

Merged
merged 3 commits into from
Dec 21, 2023
Merged

Conversation

koopa1338
Copy link
Contributor

Reading from stdin and stdout is, including newlines, for the formatted output of letposfmt as well as rustfmt. Rustfmt should already trim any empty lines at the end of a file, so this should be safe to do when reading the output and trim the ending new line.

This fixes #92 and #94 as well

@bram209
Copy link
Owner

bram209 commented Dec 21, 2023

Hi, thanks for the contribution and your bug report :)

The root cause of this is the println! at line 110: "Prints to the standard output, with a newline ."
Instead of println! the print! macro should be used to write the result back to stdout.

Could you make that change? I do not think we need to rely on trimming after this fix.
Thanks again!

@koopa1338 koopa1338 force-pushed the fix/rustfmt-stdin-newline branch from 388b3e7 to b4b459d Compare December 21, 2023 19:31
@koopa1338
Copy link
Contributor Author

koopa1338 commented Dec 21, 2023

You were right, edited my pr and tested this also with multiple calls to the formatter.

@bram209 bram209 merged commit f6b196c into bram209:main Dec 21, 2023
@bram209
Copy link
Owner

bram209 commented Dec 21, 2023

Looking good, thanks 👍

@koopa1338 koopa1338 deleted the fix/rustfmt-stdin-newline branch December 22, 2023 09:59
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 with --stdin and --rustfmt adds additional empty lines
2 participants