Skip to content

Commit

Permalink
Merge pull request #1529 from ehuss/fmt-style-check
Browse files Browse the repository at this point in the history
Enforce `cargo fmt` on the style-check code.
  • Loading branch information
traviscross authored Jul 16, 2024
2 parents cab6adb + 51c3e19 commit 3250d84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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 \
Expand Down
6 changes: 5 additions & 1 deletion style-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ fn check_directory(dir: &Path, bad: &mut bool) -> Result<(), Box<dyn Error>> {
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 &nbsp; instead");
style_error!(
bad,
path,
"don't use 0xa0 no-break-space, use &nbsp; instead"
);
}
for line in contents.lines() {
if line.ends_with(' ') {
Expand Down

0 comments on commit 3250d84

Please sign in to comment.