From 73621cb49021c90a0ee80952a96b0a66b00e4cfc Mon Sep 17 00:00:00 2001 From: escritorio-gustavo <131818645+escritorio-gustavo@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:03:48 -0300 Subject: [PATCH] Update CONTRIBUTING.md This should help people make commits without forgetting to run `cargo +nightly fmt` --- CONTRIBUTING.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 485516b..21910e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,4 +22,11 @@ There is nothing special going on here - just run `cargo build`. To run the test suite, just run `cargo test` in the root directory. ### Formatting -To ensure proper formatting, please run `cargo +nightly fmt`. +To ensure proper formatting, please make sure you have the nigthly toolchain installed. +After that, in the project's root directory, create a file called `.git/hooks/pre-commit` without a file extension and add the following two lines: +```sh +#!/bin/sh +cargo +nightly fmt +``` + +This will make sure your files are formatted before your commit is sent, so you don't have to manually run `cargo +nightly fmt`