Add './miri fmt' and use it in CI

This commit is contained in:
David Tolnay
2022-06-22 05:00:07 -07:00
parent b84754bde6
commit 2cbc461389
3 changed files with 12 additions and 11 deletions
+3 -9
View File
@@ -95,15 +95,9 @@ jobs:
# We need a toolchain that can actually build Miri, just a nightly won't do.
run: |
cargo install rustup-toolchain-install-master # TODO: cache this?
./rustup-toolchain "" -c clippy -c rustfmt
- name: rustfmt (miri, ui_test)
run: cargo fmt --all --check
- name: rustfmt (everything else)
# TODO: Add `tests` (work in progress).
# Maybe change to `find . -name '*.rs'`, superseding the previous step.
run: |
find bench-cargo-miri benches cargo-miri test-cargo-miri -name '*.rs' \
| xargs rustfmt --edition=2021 --config-path ./rustfmt.toml --check
./rustup-toolchain "" -c clippy
- name: rustfmt
run: ./miri fmt --check
- name: clippy (miri)
run: cargo clippy --all-targets -- -D warnings
#- name: Clippy (ui_test)
+8 -1
View File
@@ -21,10 +21,13 @@ to the final `cargo test` invocation.
./miri run <flags>:
Build miri, set up a sysroot and then run the driver with the given <flags>.
All commands also exist in a "-debug" variant (e.g. "./miri run-debug
The commands above also exist in a "-debug" variant (e.g. "./miri run-debug
<flags>") which uses debug builds instead of release builds, for faster build
times and slower execution times.
./miri fmt <flags>:
Format all sources and tests. <flags> are passed to `rustfmt`.
ENVIRONMENT VARIABLES
MIRI_SYSROOT:
@@ -156,6 +159,10 @@ run|run-debug)
# Then run the actual command.
exec cargo run $CARGO_BUILD_FLAGS -- --sysroot "$MIRI_SYSROOT" "$@"
;;
fmt)
find "$MIRIDIR" -not \( -name target -prune \) -name '*.rs' \
| xargs rustfmt --edition=2021 --config-path "$MIRIDIR/rustfmt.toml" "$@"
;;
*)
if [ -n "$COMMAND" ]; then
echo "Unknown command: $COMMAND"
+1 -1
View File
@@ -42,7 +42,7 @@ fi
# Install and setup new toolchain.
rustup toolchain uninstall miri
rustup-toolchain-install-master -n miri -c cargo -c rust-src -c rustc-dev -c llvm-tools "$@" -- "$NEW_COMMIT"
rustup-toolchain-install-master -n miri -c cargo -c rust-src -c rustc-dev -c llvm-tools -c rustfmt "$@" -- "$NEW_COMMIT"
rustup override set miri
# Cleanup.