Skip to content

Commit

Permalink
trim ending new line after reading to buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
koopa1338 committed Dec 5, 2023
1 parent c4a8075 commit 388b3e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ fn format_stdin(settings: FormatterSettings) -> anyhow::Result<FormatOutput> {
let mut stdin = String::new();
let _ = std::io::stdin().read_to_string(&mut stdin);

let formatted = panic::catch_unwind(|| format_file_source(&stdin, settings))
let formatted = panic::catch_unwind(|| format_file_source(stdin.trim_end(), settings))
.map_err(|e| anyhow::anyhow!(e.downcast::<String>().unwrap()))??;

Ok(FormatOutput {
Expand Down

0 comments on commit 388b3e7

Please sign in to comment.