X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ci%2Frustfmt.sh;fp=ci%2Frustfmt.sh;h=a1fdf6bd7f3282ff669944335e9d029d2a21989f;hb=eebab4015d9c84b1b605c498c9b6c166369cdb8b;hp=dfc181dee7951926cad209df3404bf9a82ac8ec8;hpb=9a438eea3b7ba3c18a36a9c257546fb28f536a50;p=rust-lightning diff --git a/ci/rustfmt.sh b/ci/rustfmt.sh index dfc181de..a1fdf6bd 100755 --- a/ci/rustfmt.sh +++ b/ci/rustfmt.sh @@ -4,10 +4,16 @@ set -eox pipefail # Generate initial exclusion list #find . -name '*.rs' -type f |sort >rustfmt_excluded_files +# The +rustversion syntax only works with rustup-installed rust toolchains, +# not with any distro-provided ones. Thus, we check for a rustup install and +# only pass +1.63.0 if we find one. +VERS="" +[ "$(which rustup)" != "" ] && VERS="+1.63.0" + # Run fmt TMP_FILE=$(mktemp) find . -name '*.rs' -type f |sort >$TMP_FILE for file in $(comm -23 $TMP_FILE rustfmt_excluded_files); do echo "Checking formatting of $file" - rustfmt +1.63.0 --check $file + rustfmt $VERS --check $file done