Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: v4.5.0
hooks:
- id: check-byte-order-marker
- id: check-case-conflict
Expand All @@ -11,6 +11,6 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pre-commit
rev: v2.5.1
rev: v3.6.2
hooks:
- id: validate_manifest
15 changes: 15 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,18 @@
args: ["--", "-D", "warnings"]
types: [rust]
pass_filenames: false
- id: test
name: test
description: Run tests with cargo test
entry: cargo test
language: system
types: [rust]
args: ["--all-targets"]
pass_filenames: false
- id: build
name: build
description: Build using cargo build
language: system
types: ["rust"]
entry: cargo build
pass_filenames: false
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@

[Rust](https://www.rust-lang.org) tools package for [pre-commit](https://pre-commit.com).

Forked from: [doublify's pre-commit-rust](https://github.com/doublify/pre-commit-rust) (**NOTE: Their repo is unmaintained**)
Copy link

@dfaure-kdab dfaure-kdab Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't belong in this MR....


## Using rust tools with pre-commit

```yaml
- repo: https://github.com/doublify/pre-commit-rust
- repo: https://github.com/antonio-hickey/rusted-pre-commits
rev: master
hooks:
- id: fmt
- id: cargo-check
- id: clippy
- id: build
- id: test
```
## Passing arguments to rustfmt
```yaml
- repo: https://github.com/doublify/pre-commit-rust
- repo: https://github.com/antonio-hickey/rusted-pre-commits
rev: master
hooks:
- id: fmt
args: ['--verbose', '--edition', '2018', '--']
args: ['--verbose', '--edition', '2021', '--']
```
8 changes: 4 additions & 4 deletions hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
- id: fmt
name: fmt
description: Format files with cargo fmt.
entry: cargo fmt --
language: system
entry: cargo fmt
language: rust
files: \.rs$
args: []
- id: cargo-check
name: cargo check
description: Check the package for errors.
entry: cargo check
language: system
language: rust
files: \.rs$
pass_filenames: false
- id: cargo-clippy
name: cargo clippy
description: Run the Clippy linter on the package.
entry: cargo clippy -- -D warnings
language: system
language: rust
files: \.rs$
pass_filenames: false