From b2c93bd969b80c65f46c43988e714a9eee39dee1 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Fri, 31 May 2019 16:31:32 -0400 Subject: [PATCH] Enforce clippy and rustfmt in CI --- .travis.yml | 7 +++++++ tests/sqlparser_common.rs | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 215b047d..e0a150fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,10 +19,17 @@ rust: before_script: - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH - cargo install --force cargo-travis && export PATH=$HOME/.cargo/bin:$PATH + - rustup component add clippy rustfmt script: + # Clippy must be run first, as its lints are only triggered during + # compilation. Put another way: after a successful `cargo build`, `cargo + # clippy` is guaranteed to produce no results. This bug is known upstream: + # https://github.com/rust-lang/rust-clippy/issues/2604. + - travis-cargo clippy -- --all-targets --all-features -- -D warnings - travis-cargo build - travis-cargo test + - travis-cargo fmt -- -- --check after_success: - cargo coveralls --verbose diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs index 7d5797aa..588ad14d 100644 --- a/tests/sqlparser_common.rs +++ b/tests/sqlparser_common.rs @@ -1317,7 +1317,7 @@ fn parse_drop_table() { ); assert_eq!(false, cascade); } - _ => assert!(false), + _ => unreachable!(), } let sql = "DROP TABLE IF EXISTS foo, bar CASCADE"; @@ -1336,7 +1336,7 @@ fn parse_drop_table() { ); assert_eq!(true, cascade); } - _ => assert!(false), + _ => unreachable!(), } let sql = "DROP TABLE"; @@ -1365,7 +1365,7 @@ fn parse_drop_view() { ); assert_eq!(SQLObjectType::View, object_type); } - _ => assert!(false), + _ => unreachable!(), } }