mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Include a conditional update script
This commit is contained in:
parent
f0aa2c1587
commit
def4a2627d
2 changed files with 40 additions and 0 deletions
|
@ -180,6 +180,15 @@ transparently:
|
|||
#[cfg_attr(feature = "cargo-clippy", allow(needless_lifetimes))]
|
||||
```
|
||||
|
||||
## Updating rustc
|
||||
|
||||
Sometimes, rustc moves forward without clippy catching up. Therefore updating
|
||||
rustc may leave clippy a non-functional state until we fix the resulting
|
||||
breakage.
|
||||
|
||||
You can use the [rust-update](rust-update) script to update rustc only if
|
||||
clippy would also update correctly.
|
||||
|
||||
## License
|
||||
|
||||
Licensed under [MPL](https://www.mozilla.org/MPL/2.0/).
|
||||
|
|
31
rust-update
Executable file
31
rust-update
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$1" = '-h' ] ; then
|
||||
echo 'Updates rustc & clippy'
|
||||
echo 'It first checks if clippy would compile at currentl nightly and if so, it updates.'
|
||||
echo 'Options:'
|
||||
echo '-h: This help message'
|
||||
echo '-f: Skips the check and just updates'
|
||||
exit
|
||||
fi
|
||||
|
||||
set -ex
|
||||
|
||||
renice -n 10 -p $$
|
||||
|
||||
export CARGO_INCREMENTAL=0
|
||||
export RUSTFLAGS='-C target-cpu=native'
|
||||
|
||||
try_out() {
|
||||
export RUSTUP_HOME=$HOME/.rustup-attempt
|
||||
test -d $RUSTUP_HOME || (rustup toolchain add nightly && rustup default nightly)
|
||||
rustup update
|
||||
cargo +nightly install --force clippy
|
||||
unset RUSTUP_HOME
|
||||
export RUSTUP_HOME
|
||||
}
|
||||
|
||||
[ "$1" = '-f' ] || try_out
|
||||
|
||||
rustup update
|
||||
cargo +nightly install --force clippy
|
Loading…
Reference in a new issue