#!/bin/bash

# This pre-commit hook uses cargo fmt to check the code style
# Install it either with `make githooks` or copy the file to .git/hooks

echo '+cargo fmt -- --check'
cargo fmt -- --check
result=$?

if [[ ${result} -ne 0 ]] ; then
    cat <<\EOF
There are some code style issues, run `cargo fmt` first.
EOF
    exit 1
fi

exit 0