#!/bin/sh if ! which cargo &> /dev/null; then echo "Commit aborted! Please install cargo and rustfmt to check the code style of Fractal." exit -1 fi if ! cargo fmt --help &> /dev/null; then echo "Commit aborted! You need rustfmt to check the code style of Fractal." echo "Install it via rustup ('rustup component add rustfmt') or your package manager." exit -1 fi echo "--Checking style--" cargo fmt --all -- --check if test $? != 0; then echo "--Checking style fail--" echo "Please fix the above issues, either manually or by running: cargo fmt --all" exit -1 else echo "--Checking style pass--" fi