mirror of
https://github.com/openharmony/third_party_rust_bindgen.git
synced 2026-07-21 07:05:24 -04:00
Improve the script to enforce rustfmt on automation.
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-2
@@ -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
|
||||
;;
|
||||
|
||||
|
||||
+4
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user