From 1e2fd9c92f8cd6e389525ca1a999fca4c90b5921 Mon Sep 17 00:00:00 2001 From: Mario Reder Date: Fri, 14 Feb 2020 15:25:03 +0100 Subject: 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 --- install.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'install.sh') diff --git a/install.sh b/install.sh index 85bdad7..1075061 100755 --- a/install.sh +++ b/install.sh @@ -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." -- cgit v1.2.3