Skip to content

Enforce cargo fmt on the style-check code. #1529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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