Skip to content

Commit

Permalink
feat(build): Use RUSTFMT to find rustfmt binary (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre authored Mar 11, 2021
1 parent 61555ff commit ea56e2e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tonic-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,14 @@ pub fn fmt(out_dir: &str) {
if !file.ends_with(".rs") {
continue;
}
let result = Command::new("rustfmt")
.arg("--emit")
.arg("files")
.arg("--edition")
.arg("2018")
.arg(format!("{}/{}", out_dir, file))
.output();
let result =
Command::new(std::env::var("RUSTFMT").unwrap_or_else(|_| "rustfmt".to_owned()))
.arg("--emit")
.arg("files")
.arg("--edition")
.arg("2018")
.arg(format!("{}/{}", out_dir, file))
.output();

match result {
Err(e) => {
Expand Down

0 comments on commit ea56e2e

Please sign in to comment.