Skip to content

Commit 51fc5c1

Browse files
author
Jb DOYON
committedApr 10, 2022
Fix pre-commit hooks and Make call
Formatter should run on nightly Rust, so should clippy the linter. Unfortunately, the pre-commit hook won't let us specify toolchain[1]. Instead, redefine the hook locally, with the right flags. [1]: doublify/pre-commit-rust#15 (comment)
1 parent fdefa2e commit 51fc5c1

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed
 

‎.pre-commit-config.yaml

+13-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@ repos:
1414
rev: v1.0
1515
hooks:
1616
- id: cargo-check
17-
- id: fmt
17+
# fmt provided locally instead
1818
- repo: local
1919
hooks:
2020
- id: clippy
2121
name: cargo clippy
2222
description: Run the Clippy linter on the package.
23-
entry: cargo clippy --all-features --tests
23+
entry: cargo +nightly clippy
24+
args: ["--all-features", "--tests", "--"]
2425
language: system
25-
files: \.rs$
26+
types: [rust]
2627
pass_filenames: false
28+
- repo: local
29+
hooks:
30+
- id: fmt
31+
name: cargo fmt
32+
description: Format files with cargo fmt.
33+
entry: cargo +nightly fmt
34+
language: system
35+
types: [rust]
36+
args: ["--"]

‎Makefile

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ check:
55
cargo check
66

77
lint:
8-
cargo +nightly fmt
9-
cargo clippy
10-
11-
# lint:
12-
# pre-commit run --all --all-files
8+
pre-commit run --all --all-files
139

1410
build:
1511
cargo build

0 commit comments

Comments
 (0)
Please sign in to comment.