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
|
fi
|
||||||
|
|
||||||
printf "${PREFIX} Checking for rustfmt ... "
|
printf "${PREFIX} Checking for rustfmt ... "
|
||||||
command -v cargo fmt &>/dev/null
|
command -v rustfmt &>/dev/null
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
printf "${SUCCESS}\n"
|
printf "${SUCCESS}\n"
|
||||||
else
|
else
|
||||||
@@ -93,7 +93,7 @@ diff=""
|
|||||||
for file in $(git diff --name-only --cached);
|
for file in $(git diff --name-only --cached);
|
||||||
do
|
do
|
||||||
if [ ${file: -3} == ".rs" ]; then
|
if [ ${file: -3} == ".rs" ]; then
|
||||||
diff="$diff$(cargo fmt -- --check $file)"
|
diff="$diff$(rustfmt --edition 2018 --check $file)"
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
FMTRESULT=1
|
FMTRESULT=1
|
||||||
fi
|
fi
|
||||||
@@ -105,7 +105,7 @@ if [ "${TARPC_SKIP_RUSTFMT}" == 1 ]; then
|
|||||||
elif [ ${FMTRESULT} != 0 ]; then
|
elif [ ${FMTRESULT} != 0 ]; then
|
||||||
FAILED=1
|
FAILED=1
|
||||||
printf "${FAILURE}\n"
|
printf "${FAILURE}\n"
|
||||||
echo "$diff" | sed 's/Using rustfmt config file.*$/d/'
|
echo "$diff"
|
||||||
else
|
else
|
||||||
printf "${SUCCESS}\n"
|
printf "${SUCCESS}\n"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user