Skip to content

Commit

Permalink
Drop the rustup-specific calling in ci/rustfmt.sh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TheBlueMatt committed Apr 22, 2024
1 parent eeea0f4 commit 6ab91cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ci/rustfmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6ab91cb

Please sign in to comment.