Skip to content

Commit

Permalink
trim ending new lines
Browse files Browse the repository at this point in the history
  • Loading branch information
koopa1338 committed Dec 5, 2023
1 parent dfc05ea commit c4a8075
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,12 @@ fn run_rustfmt(source: &str) -> Option<String> {
let output = child.wait_with_output().expect("failed to read stdout");

if output.status.success() {
Some(String::from_utf8(output.stdout).expect("stdout is not valid utf8"))
Some(
std::str::from_utf8(&output.stdout)
.expect("stdout is not valid utf8")
.trim_end()
.to_owned(),
)
} else {
None
}
Expand Down

0 comments on commit c4a8075

Please sign in to comment.