Skip to content

Commit c85f961

Browse files
committed
chore: Add auto-fix fallback for Clippy pre-commit hook
The commit modifies the Cargo Clippy pre-commit hook to automatically attempt fixing linting issues when the initial check fails. This provides a better developer experience by trying to resolve common linting problems automatically using `clippy --fix` before requiring manual intervention.
1 parent a7b34a4 commit c85f961

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ repos:
3737
- id: cargo-clippy
3838
name: cargo clippy
3939
description: Lint Rust code with Clippy
40-
entry: cargo clippy --workspace --all-targets --all-features -- -D warnings
40+
entry: bash -c 'cargo clippy --workspace --all-targets --all-features -- -D warnings || (echo "Regular clippy failed, attempting to fix..." && cargo clippy --workspace --all-targets --all-features --fix --allow-dirty --allow-staged -- -D warnings)'
4141
language: system
4242
types: [rust]
4343
pass_filenames: false # Clippy should check the entire project

0 commit comments

Comments
 (0)