Skip to content

Repository files navigation

Rust hooks for pre-commit

pre-commit hooks for Rust tools.

Usage

First, install the pre-commit Python package.

Second, create a .pre-commit-config.yaml file in the top level of your Git-based project with the following content:

- repo: https://github.com/berquist/pre-commit-rustrev: mainhooks:
- id: cargo-fmt
- id: cargo-check
- id: cargo-clippy
- id: cargo-test

Finally, install the pre-commit hook locally and run it for the first time:

pre-commit install
pre-commit run -a

Passing arguments to rustfmt

- repo: https://github.com/berquist/pre-commit-rustrev: mainhooks:
- id: cargo-fmtargs: ['--verbose', '--', '--edition', '2018' ]

Note: cargo fmt picks up "edition" automatically from Cargo.toml, so specifying this isn't necessary in most cases.

About

Rust hooks for pre-commit

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors