summaryrefslogtreecommitdiffstats
path: root/third_party/rust/audio-mixer/install_rustfmt_clippy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/audio-mixer/install_rustfmt_clippy.sh')
-rw-r--r--third_party/rust/audio-mixer/install_rustfmt_clippy.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/third_party/rust/audio-mixer/install_rustfmt_clippy.sh b/third_party/rust/audio-mixer/install_rustfmt_clippy.sh
new file mode 100644
index 0000000000..5063059c60
--- /dev/null
+++ b/third_party/rust/audio-mixer/install_rustfmt_clippy.sh
@@ -0,0 +1,17 @@
+# https://github.com/rust-lang/rustup-components-history/blob/master/README.md
+# https://github.com/rust-lang/rust-clippy/blob/27acea0a1baac6cf3ac6debfdbce04f91e15d772/.travis.yml#L40-L46
+if ! rustup component add rustfmt; then
+ TARGET=$(rustc -Vv | awk '/host/{print $2}')
+ NIGHTLY=$(curl -s "https://rust-lang.github.io/rustup-components-history/${TARGET}/rustfmt")
+ curl -sSL "https://static.rust-lang.org/dist/${NIGHTLY}/rustfmt-nightly-${TARGET}.tar.xz" | \
+ tar -xJf - --strip-components=3 -C ~/.cargo/bin
+ rm -rf ~/.cargo/bin/doc
+fi
+
+if ! rustup component add clippy; then
+ TARGET=$(rustc -Vv | awk '/host/{print $2}')
+ NIGHTLY=$(curl -s "https://rust-lang.github.io/rustup-components-history/${TARGET}/clippy")
+ rustup default nightly-${NIGHTLY}
+ rustup component add rustfmt
+ rustup component add clippy
+fi