From 1f625fe69d2ba7a56eac036e43c70be91f366d66 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Sat, 24 Jun 2017 12:27:37 -0500 Subject: [PATCH] Enable Clippy in travis This will run clippy on all builds, and as long as clippy successfully compiles it will deny builds that fail clippy lints. --- .travis.sh | 16 +++++++++++++++- .travis.yml | 6 ++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.travis.sh b/.travis.sh index cba5909..120cbbe 100755 --- a/.travis.sh +++ b/.travis.sh @@ -46,11 +46,25 @@ build_only() { channel build -v --features 'serde bincode' } +run_clippy() { + # cached installation will not work on a later nightly + if [ -n "${TRAVIS}" ] && ! cargo install clippy --debug --force; then + echo "COULD NOT COMPILE CLIPPY, IGNORING CLIPPY TESTS" + exit + fi + + cargo clippy --features 'serde bincode rustc-serialize' -- -Dclippy +} + rustc --version cargo --version CHANNEL=nightly -build_and_test +if [ "x${CLIPPY}" = xy ] ; then + run_clippy +else + build_and_test +fi CHANNEL=beta build_and_test diff --git a/.travis.yml b/.travis.yml index 74a29cb..3b726d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,9 +12,15 @@ os: matrix: allow_failures: - rust: nightly + env: CLIPPY=n + include: + - rust: nightly + env: CLIPPY=y + env: global: - LD_LIBRARY_PATH: /usr/local/lib + - CLIPPY: n script: ./.travis.sh notifications: email: false