Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.16 KB

File metadata and controls

38 lines (27 loc) · 1.16 KB

pre-commit hooks for Rust

Rust hooks for pre-commit.

This repo was inspired by the pre-commit hooks found in doublify/pre-commit-rust on 20-Mar-2023.

The code here is released with the 0BSD license.

Using the hooks

Add the following entry to your .pre-commit.yml

-   repo: https://github.com/backplane/pre-commit-rust-hooks
    rev: v1.2.0
    hooks:
    -   id: fmt
    -   id: check
    -   id: clippy
    -   id: test

Note: The id fmt-check is also available if you don't want automatic changes.

Passing arguments:

If you pass an args list to a hook that receives filename arguments you should end that list with the -- terminator (see below).

  • The fmt and fmt-check hooks receive a list of filenames at the end of their arguments.
  • The check, clippy, and test hooks do not receive a list of filenames as arguments.
-   repo: https://github.com/backplane/pre-commit-rust-hooks
    rev: v1.2.0
    hooks:
    -   id: fmt
        args: ['--verbose', '--edition', '2018', '--']