Skip to content

Commit c09cec0

Browse files
committed
replace multiple checks of nightly with is_nightly()
Signed-off-by: Yang Hongbo <[email protected]>
1 parent 90e068d commit c09cec0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

build-new-version.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ RUSTC_TRIPLES=(
4747
x86_64-unknown-linux-gnu
4848
)
4949

50+
is_nightly() {
51+
if [ x"$TARGET_VERSION" == x"nightly" -a "$NIGHTLY_DATE" ]; then
52+
true
53+
else
54+
false
55+
fi
56+
}
57+
5058
download() {
5159
echo "download $@"
5260
curl --fail -# -O $@
@@ -55,7 +63,7 @@ download() {
5563
dlfile() {
5664
component="$1"
5765
triple="$2"
58-
if [ x"$TARGET_VERSION" == x"nightly" -a "$NIGHTLY_DATE" ]; then
66+
if is_nightly; then
5967
download "https://static.rust-lang.org/dist/$NIGHTLY_DATE/$component-$TARGET_VERSION-$triple.tar.gz"
6068
else
6169
download "https://static.rust-lang.org/dist/$component-$TARGET_VERSION-$triple.tar.gz"
@@ -100,7 +108,7 @@ cargo_filename() {
100108
}
101109

102110
download_files() {
103-
if [ x"$TARGET_VERSION" == x"nightly" -a "$NIGHTLY_DATE" ]; then
111+
if is_nightly; then
104112
download "https://static.rust-lang.org/dist/$NIGHTLY_DATE/$CHANNEL_FILE"
105113
else
106114
download "https://static.rust-lang.org/dist/$CHANNEL_FILE"

0 commit comments

Comments
 (0)