Skip to content

Commit 1146f66

Browse files
committed
rust-fmt: run cargo fmt --all
1 parent 9760795 commit 1146f66

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
pass_filenames: false
6868

6969
- id: rust-check
70-
name: 'Run cargo check'
70+
name: 'Cargo check'
7171
entry: run-rust-check.sh
7272
language: 'script'
7373
files: Cargo\.toml|\.rs$
@@ -76,7 +76,7 @@
7676
description: 'Run cargo check against all features & targets'
7777

7878
- id: rust-clippy
79-
name: 'Run clippy lints'
79+
name: 'Clippy lints'
8080
entry: run-rust-clippy.sh
8181
language: 'script'
8282
files: Cargo\.toml|\.rs$
@@ -93,6 +93,15 @@
9393
minimum_pre_commit_version: 0.15.0
9494
description: 'Run cargo test in the repo root'
9595

96+
- id: rust-fmt
97+
name: 'Cargo fmt'
98+
entry: run-rust-fmt.sh
99+
language: 'script'
100+
files: \.rs$
101+
pass_filenames: false
102+
minimum_pre_commit_version: 0.15.0
103+
description: 'Run cargo fmt in the repo root'
104+
96105
- id: r-stylr
97106
name: 'Format with stylr'
98107
entry: run-r-stylr.R

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Hooks:
1515
* `rust-check`: runs `cargo check` against all features & targets
1616
* `rust-clippy`: runs `cargo clippy` lints in the repo root
1717
* `rust-test`: runs `cargo test` at the repo root, includes all targets/features/examples/benches
18+
* `rust-fmt`: runs `cargo fmt --all`
1819
* `r-stylr`: runs [`stylr`] to format R code
1920
* `r-lintr`: static analysis of R code with [`lintr`]
2021

run-rust-fmt.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
cargo fmt --all

0 commit comments

Comments
 (0)