We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f3a26e1 commit 92327f0Copy full SHA for 92327f0
pre-commit-hooks/rust-fmt.sh
@@ -3,9 +3,13 @@
3
# Exit immediately if a command exits with a non-zero status
4
set -e
5
6
+# Get the directory to run cargo fmt in, default to current directory
7
+RUST_DIR=${1:-.}
8
+
9
# Function to format rust code
10
run_cargo_fmt() {
11
echo "Executing 'cargo fmt'"
12
+ cd "$RUST_DIR"
13
cargo fmt
14
}
15
pre-commit-hooks/rust-lint.sh
@@ -3,12 +3,16 @@
# Exit immediately if a command exits with a non-zero status.
# Function to run linters on the rust project
run_linter() {
echo "Executing clippy"
# Run the linter and capture the exit status
set +e
16
cargo clippy -- -D warnings
17
local linting_result=$?
18
0 commit comments