Преглед изворни кода

Add clippy to CI

Closes: #240
Approved by: dlrobertson
Dan Robertson пре 6 година
родитељ
комит
bf249333cd
2 измењених фајлова са 6 додато и 0 уклоњено
  1. 3 0
      .travis.yml
  2. 3 0
      src/lib.rs

+ 3 - 0
.travis.yml

@@ -37,6 +37,8 @@ matrix:
         MODE='build'
     - rust: nightly
       env: MODE='fuzz run' ARGS='packet_parser -- -max_len=1536 -max_total_time=30'
+    - rust: nightly
+      env: FEATURES='default' MODE='clippy'
   allow_failures:
     # something's screwy with Travis (as usual) and cargo-fuzz dies with a LeakSanitizer error
     # even when it's successful. Keep this in .travis.yml in case it starts working some day.
@@ -44,6 +46,7 @@ matrix:
       env: MODE='fuzz run' ARGS='packet_parser -- -max_len=1536 -max_total_time=30'
 before_script:
   - if [ "$MODE" == "fuzz run" ]; then cargo install cargo-fuzz; fi
+  - if [ "$MODE" == "clippy" ]; then cargo install clippy; fi
 script:
   - cargo $MODE --no-default-features --features "$FEATURES" $ARGS
 notifications:

+ 3 - 0
src/lib.rs

@@ -88,6 +88,9 @@
                feature = "socket-tcp")))]
 compile_error!("at least one socket needs to be enabled"); */
 
+// FIXME(dlrobertson): clippy fails with this lint
+#![cfg_attr(feature = "cargo-clippy", allow(if_same_then_else))]
+
 #[cfg(feature = "proto-ipv6")]
 #[macro_use]
 extern crate bitflags;