]> git.lizzy.rs Git - rust.git/blob - rust-update
Lint against needless uses of `collect()`
[rust.git] / rust-update
1 #!/bin/sh
2
3 if [ "$1" = '-h' ] ; then
4         echo 'Updates rustc & clippy'
5         echo 'It first checks if clippy would compile at current nightly and if so, it updates.'
6         echo 'Options:'
7         echo '-h: This help message'
8         echo '-f: Skips the check and just updates'
9         exit
10 fi
11
12 set -ex
13
14 renice -n 10 -p $$
15
16 export CARGO_INCREMENTAL=0
17 export RUSTFLAGS='-C target-cpu=native'
18
19 try_out() {
20         export RUSTUP_HOME=$HOME/.rustup-attempt
21         test -d $RUSTUP_HOME || (rustup toolchain add nightly && rustup default nightly)
22         rustup update
23         cargo +nightly install --force clippy
24         unset RUSTUP_HOME
25         export RUSTUP_HOME
26 }
27
28 [ "$1" = '-f' ] || try_out
29
30 rustup update
31 cargo +nightly install --force clippy