Skip to content

Commit

Permalink
Format web-sys bindings by default
Browse files Browse the repository at this point in the history
This commit switches to executing `rustfmt` by default on
`web-sys`-generated bindings. This improves situations like "view
source" in Rustdoc as well as the IDE interactive debugging experience.

This was initially disabled by default because `rustfmt` took so long to
execute, but nowadays `web-sys` is by default much smaller so there's
much less need to avoid running `rustfmt` in fear of it taking too
long.

Closes #1457
  • Loading branch information
alexcrichton committed Apr 15, 2019
1 parent 744b031 commit fd4f0b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/web-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ fn try_main() -> Result<(), failure::Error> {

// run rustfmt on the generated file - really handy for debugging
println!("cargo:rerun-if-env-changed=WEBIDL_RUSTFMT_BINDINGS");
if env::var("WEBIDL_RUSTFMT_BINDINGS").is_ok() {
if env::var("WEBIDL_RUSTFMT_BINDINGS").ok() != Some("0".to_string()) {
let status = Command::new("rustfmt")
.arg(&out_file_path)
.status()
.context("running rustfmt")?;
if !status.success() {
bail!("rustfmt failed: {}", status)
println!("cargo:warning=rustfmt failed: {}", status)
}
}

Expand Down

0 comments on commit fd4f0b6

Please sign in to comment.