Skip to content

Commit 0f19f71

Browse files
committed
contrib: improve check-fmt.sh script
Try to install toolchain only if not exists Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent 377e480 commit 0f19f71

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/scripts/check-fmt.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
set -euo pipefail
44

5+
version="nightly-2024-01-11"
56
flags=""
67

78
# Check if "check" is passed as an argument
@@ -10,8 +11,7 @@ if [[ "$#" -gt 0 && "$1" == "check" ]]; then
1011
fi
1112

1213
# Install toolchain
13-
rustup install nightly-2024-01-11
14-
rustup component add rustfmt --toolchain nightly-2024-01-11
14+
cargo +$version --version || (rustup install $version && rustup component add rustfmt --toolchain $version)
1515

1616
# Check workspace crates
17-
cargo +nightly-2024-01-11 fmt --all -- --config format_code_in_doc_comments=true $flags
17+
cargo +$version fmt --all -- --config format_code_in_doc_comments=true $flags

0 commit comments

Comments
 (0)