From 6ab91cb43fbaeeb9dbf26b1c1c953373bc9fd4cf Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 22 Apr 2024 13:03:14 +0000 Subject: [PATCH] Drop the rustup-specific calling in `ci/rustfmt.sh` The +rustversion call semantics are specific to rustup and do not work with standard rust toolchains. However, because rustfmt formatting differs slightly between stable and our 1.63 target, we need to keep the +1.63.0 for rustup users. Thus, here, we check for the presence of a `rustup` command and pass the "+1.63.0" argument if we find one. --- ci/rustfmt.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/rustfmt.sh b/ci/rustfmt.sh index dfc181dee..a1fdf6bd7 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 -- 2.39.5