Skip to content

Commit dd21b21

Browse files
committed
Improve the script to enforce rustfmt on automation.
1 parent 2f621dd commit dd21b21

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

ci/assert-rustfmt.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
set -xeu
44
cd "$(dirname "$0")/.."
55

6-
# Ensure we have the most up-to-date `rustfmt`.
7-
cargo install -f rustfmt
6+
rustup update nightly
7+
rustup component add rustfmt --toolchain nightly
88

99
# Run `rustfmt` on the crate! If `rustfmt` can't make a long line shorter, it
1010
# prints an error and exits non-zero, so tell it to kindly shut its yapper and
1111
# make sure it doesn't cause us to exit this whole script non-zero.
12-
cargo fmt --quiet || true
13-
14-
# Exit non-zero if this resulted in any diffs.
15-
./ci/assert-no-diff.sh
16-
12+
rustup run nightly cargo fmt -- --check

ci/script.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ case "$BINDGEN_JOB" in
4545
./ci/assert-docs.sh
4646
./ci/test-book.sh
4747
./ci/no-includes.sh
48-
# `rustfmt` isn't reaching a fixed point on bindgen
49-
# code... https://github.com/rust-lang/rustfmt/issues/1376
48+
# Disabled because https://github.com/rust-lang/rustfmt/issues/3799.
5049
# ./ci/assert-rustfmt.sh
5150
;;
5251

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,10 @@ impl Bindings {
19581958
}
19591959
}
19601960
#[cfg(not(feature = "which-rustfmt"))]
1961-
Err(io::Error::new(io::ErrorKind::Other, "which wasn't enabled, and no rustfmt binary specified"))
1961+
Err(io::Error::new(
1962+
io::ErrorKind::Other,
1963+
"which wasn't enabled, and no rustfmt binary specified",
1964+
))
19621965
}
19631966

19641967
/// Checks if rustfmt_bindings is set and runs rustfmt on the string

0 commit comments

Comments
 (0)