From 51c3e191e8c8d026a62b3fac93cd7f6e2b1b28b4 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 15 Jul 2024 10:44:35 -0700 Subject: [PATCH] Enforce `cargo fmt` on the style-check code. --- .github/workflows/main.yml | 8 ++++++-- style-check/src/main.rs | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 227aeba5e..98093a7b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: - name: Install Rust run: | rustup set profile minimal - rustup toolchain install nightly -c rust-docs + rustup toolchain install nightly -c rust-docs,rustfmt rustup default nightly - name: Install mdbook run: | @@ -44,7 +44,11 @@ jobs: - name: Run tests run: mdbook test - name: Style checks - run: (cd style-check && cargo run -- ../src) + working-directory: style-check + run: cargo run -- ../src + - name: Style fmt + working-directory: style-check + run: cargo fmt --check - name: Check for broken links run: | curl -sSLo linkcheck.sh \ diff --git a/style-check/src/main.rs b/style-check/src/main.rs index 8452b26dc..e8bac074d 100644 --- a/style-check/src/main.rs +++ b/style-check/src/main.rs @@ -71,7 +71,11 @@ fn check_directory(dir: &Path, bad: &mut bool) -> Result<(), Box> { style_error!(bad, path, "em-dash not allowed, use three dashes like ---"); } if contents.contains('\u{a0}') { - style_error!(bad, path, "don't use 0xa0 no-break-space, use   instead"); + style_error!( + bad, + path, + "don't use 0xa0 no-break-space, use   instead" + ); } for line in contents.lines() { if line.ends_with(' ') {