diff options
| author | Mario Reder <mreder1289@gmail.com> | 2020-02-14 15:25:03 +0100 |
|---|---|---|
| committer | Mario Reder <mreder1289@gmail.com> | 2020-02-26 14:07:07 +0100 |
| commit | 1e2fd9c92f8cd6e389525ca1a999fca4c90b5921 (patch) | |
| tree | aace341dbef4b15e37ddf260d6be857a11cca104 /install.sh | |
| parent | 7e8530b21ff355c9b52e07eb3ba25278746a6932 (diff) | |
feat: Add clippy lints
- adds a new 'clippy' category for exercises
- clippy exercises should throw no warnings
- install script now also installs clippy
is related to https://github.com/rust-lang/rust-clippy/issues/2604
Diffstat (limited to 'install.sh')
| -rwxr-xr-x | install.sh | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -82,21 +82,24 @@ else echo "SUCCESS: Rust is up to date" fi -Path=${1:-rustlings/} -echo "Cloning Rustlings at $Path..." -git clone -q https://github.com/rust-lang/rustlings $Path - Version=$(curl -s https://api.github.com/repos/rust-lang/rustlings/releases/latest | python -c "import json,sys;obj=json.load(sys.stdin);print(obj['tag_name']);") -echo "Checking out version $Version..." -cd $Path -git checkout -q tags/$Version +CargoBin="${CARGO_HOME:-$HOME/.cargo}/bin" echo "Installing the 'rustlings' executable..." -cargo install --force --path . +cargo install --force --git https://github.com/rust-lang/rustlings --tag $Version if ! [ -x "$(command -v rustlings)" ] then - echo "WARNING: Please check that you have '~/.cargo/bin' in your PATH environment variable!" + echo "WARNING: Please check that you have '$CargoBin' in your PATH environment variable!" +fi + +# Checking whether Clippy is installed. +# Due to a bug in Cargo, this must be done with Rustup: https://github.com/rust-lang/rustup/issues/1514 +Clippy=$(rustup component list | grep "clippy" | grep "installed") +if [ -z "$Clippy" ] +then + echo "Installing the 'cargo-clippy' executable..." + rustup component add clippy fi echo "All done! Run 'rustlings' to get started." |
