mirror of
https://github.com/OMGeeky/tarpc.git
synced 2025-12-26 17:02:32 +01:00
Use rustfmt instead of cargo fmt so that diff is only printed once
This commit is contained in:
@@ -67,7 +67,7 @@ else
|
||||
fi
|
||||
|
||||
printf "${PREFIX} Checking for rustfmt ... "
|
||||
command -v cargo fmt &>/dev/null
|
||||
command -v rustfmt &>/dev/null
|
||||
if [ $? == 0 ]; then
|
||||
printf "${SUCCESS}\n"
|
||||
else
|
||||
@@ -93,7 +93,7 @@ diff=""
|
||||
for file in $(git diff --name-only --cached);
|
||||
do
|
||||
if [ ${file: -3} == ".rs" ]; then
|
||||
diff="$diff$(cargo fmt -- --check $file)"
|
||||
diff="$diff$(rustfmt --edition 2018 --check $file)"
|
||||
if [ $? != 0 ]; then
|
||||
FMTRESULT=1
|
||||
fi
|
||||
@@ -105,7 +105,7 @@ if [ "${TARPC_SKIP_RUSTFMT}" == 1 ]; then
|
||||
elif [ ${FMTRESULT} != 0 ]; then
|
||||
FAILED=1
|
||||
printf "${FAILURE}\n"
|
||||
echo "$diff" | sed 's/Using rustfmt config file.*$/d/'
|
||||
echo "$diff"
|
||||
else
|
||||
printf "${SUCCESS}\n"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user