From f1fbea181ad22b5e92541b24021f109f8d414de2 Mon Sep 17 00:00:00 2001
From: Chris Wong <lambda.fairy@gmail.com>
Date: Sat, 29 Jul 2017 20:01:14 +1200
Subject: [PATCH] Reduce duplication in Travis config

---
 .travis.yml | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 93cbc23..e9f1b18 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,11 +12,12 @@ script:
       printf 'Checking for tabs in %s\n' "$TRAVIS_COMMIT_RANGE"
       ! git diff --name-only --diff-filter=ACMR "$TRAVIS_COMMIT_RANGE" | xargs grep $'\t'
     fi
-  - ( cd maud_htmlescape && cargo test --all-features )
-  - if command -v cargo-clippy > /dev/null; then ( cd maud_htmlescape && cargo clippy -- -D warnings ); fi
-  - ( cd maud && cargo test --all-features )
-  - if command -v cargo-clippy > /dev/null; then ( cd maud && cargo clippy -- -D warnings ); fi
-  - ( cd maud_macros && cargo test --all-features )
-  - if command -v cargo-clippy > /dev/null; then ( cd maud_macros && cargo clippy -- -D warnings ); fi
-  - ( cd maud_extras && cargo test --all-features )
-  - if command -v cargo-clippy > /dev/null; then ( cd maud_extras && cargo clippy -- -D warnings ); fi
+  - cargo test --all --all-features
+  - |
+    if command -v cargo-clippy > /dev/null; then
+      CLIPPY_STATUS=0
+      for package in maud_htmlescape maud_macros maud maud_extras; do
+        cargo clippy --manifest-path $package/Cargo.toml -- -D warnings || CLIPPY_STATUS=$?
+      done
+      (exit $CLIPPY_STATUS)
+    fi