diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-09-17 09:49:08 +0900 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-09-17 11:53:23 +0900 |
commit | dd21b210dd7c7b91a571ed83e9bbbb249f24aa8b (patch) | |
tree | 56dc1cc5347eb48af6239d635c30840d2eff7946 | |
parent | 2f621ddeae1081d4f223c4498ebf86a9ee0a7e7e (diff) |
Improve the script to enforce rustfmt on automation.
-rwxr-xr-x | ci/assert-rustfmt.sh | 10 | ||||
-rwxr-xr-x | ci/script.sh | 3 | ||||
-rw-r--r-- | src/lib.rs | 5 |
3 files changed, 8 insertions, 10 deletions
diff --git a/ci/assert-rustfmt.sh b/ci/assert-rustfmt.sh index bd268600..de8ede82 100755 --- a/ci/assert-rustfmt.sh +++ b/ci/assert-rustfmt.sh @@ -3,14 +3,10 @@ set -xeu cd "$(dirname "$0")/.." -# Ensure we have the most up-to-date `rustfmt`. -cargo install -f rustfmt +rustup update nightly +rustup component add rustfmt --toolchain nightly # Run `rustfmt` on the crate! If `rustfmt` can't make a long line shorter, it # prints an error and exits non-zero, so tell it to kindly shut its yapper and # make sure it doesn't cause us to exit this whole script non-zero. -cargo fmt --quiet || true - -# Exit non-zero if this resulted in any diffs. -./ci/assert-no-diff.sh - +rustup run nightly cargo fmt -- --check diff --git a/ci/script.sh b/ci/script.sh index 7003618a..73c5614b 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -45,8 +45,7 @@ case "$BINDGEN_JOB" in ./ci/assert-docs.sh ./ci/test-book.sh ./ci/no-includes.sh - # `rustfmt` isn't reaching a fixed point on bindgen - # code... https://github.com/rust-lang/rustfmt/issues/1376 + # Disabled because https://github.com/rust-lang/rustfmt/issues/3799. # ./ci/assert-rustfmt.sh ;; @@ -1958,7 +1958,10 @@ impl Bindings { } } #[cfg(not(feature = "which-rustfmt"))] - Err(io::Error::new(io::ErrorKind::Other, "which wasn't enabled, and no rustfmt binary specified")) + Err(io::Error::new( + io::ErrorKind::Other, + "which wasn't enabled, and no rustfmt binary specified", + )) } /// Checks if rustfmt_bindings is set and runs rustfmt on the string |