Просмотр исходного кода

book/development: Update pre-commit hook.

parazyd 4 лет назад
Родитель
Сommit
c098f5c353
1 измененных файлов с 3 добавлено и 6 удалено
  1. 3 6
      book/src/development.md

+ 3 - 6
book/src/development.md

@@ -1,18 +1,15 @@
 Notes for developers
 ====================
 
-## `cargo fmt` pre-commit hook
+## cargo fmt pre-commit hook
 
 To ensure every contributor uses the same code style, make sure
 you run `cargo fmt` before committing. You can force yourself to do
 this by creating a git `pre-commit` hook like the following:
 
 ```shell
-#!/bin/bash
-diff="$(cargo fmt -- --check)
-result=$?
-
-if [[ "$result" -ne 0 ]]; then
+#!/bin/sh
+if ! cargo fmt -- --check >/dev/null; then
     echo "There are some code style issues. Run 'cargo fmt' to fix it."
     exit 1
 fi