Skip to content

Commit c79df83

Browse files
committed
devops: Add test-linting to pre-commit hook
Adds `--all-targets` to the pre-commit hook by following the guide in https://github.com/rhysd/cargo-husky?tab=readme-ov-file#user-hooks
1 parent 638b0ae commit c79df83

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.cargo-husky/hooks/pre-commit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
#
3+
# This hook was defined by sword-smith <[email protected]>
4+
# It's intended to be copied to `.git/hooks/` by `cargo-husky`.
5+
6+
set -e
7+
8+
echo '+cargo clippy --all-targets -- -D warnings'
9+
cargo clippy --all-targets -- -D warnings
10+
echo '+cargo fmt --all -- --check'
11+
cargo fmt --all -- --check

twenty-first/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ trybuild = "1.0"
2929
[dev-dependencies.cargo-husky]
3030
version = "1"
3131
default-features = false
32-
features = ["precommit-hook", "run-cargo-clippy", "run-cargo-fmt"]
32+
features = ["user-hooks"]
3333

3434
[dependencies]
3535
arbitrary = { version = "1", features = ["derive"] }

0 commit comments

Comments
 (0)