add clippy to travis integration
authorRyan Loomba <ryan@loomba.io>
Tue, 6 Oct 2020 23:49:06 +0000 (16:49 -0700)
committerRyan Loomba <ryan@loomba.io>
Thu, 8 Oct 2020 16:59:52 +0000 (09:59 -0700)
.travis.yml
CONTRIBUTING.md
lightning/src/lib.rs
lightning/src/ln/channelmanager.rs

index 1e136798133cc40e172fe9aa57ec1738b90ee851..8c1f2fd0f0da7fc8454987d56a7610b11dad37b6 100644 (file)
@@ -22,6 +22,10 @@ script:
      - if [ "$BUILD_NET_TOKIO" == "1" ]; then RUSTFLAGS="-C link-dead-code" cargo build --verbose; fi
      - if [ "$BUILD_NET_TOKIO" != "1" ]; then RUSTFLAGS="-C link-dead-code" cargo build --verbose -p lightning; fi
      - rm -f target/debug/lightning-* # Make sure we drop old test binaries
+     # Run clippy on Rust 1.39.0
+     - if [ "$(rustup show | grep default | grep 1.39.0)" != "" ]; then
+           rustup component add clippy &&
+           cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else; fi
      # Test the appropriate workspace(s)
      - if [ "$BUILD_NET_TOKIO" == "1" ]; then RUSTFLAGS="-C link-dead-code" cargo test --verbose; fi
      - if [ "$BUILD_NET_TOKIO" != "1" ]; then RUSTFLAGS="-C link-dead-code" cargo test --verbose -p lightning; fi
index b270492bf44cbb6e717d07f5699672ea0c694b31..241c64208565459a0abf5a5d9818365add6de617 100644 (file)
@@ -77,6 +77,18 @@ Coding Conventions
 Use tabs. If you want to align lines, use spaces. Any desired alignment should
 display fine at any tab-length display setting.
 
+Our CI enforces [clippy's](https://github.com/rust-lang/rust-clippy) default linting
+[settings](https://rust-lang.github.io/rust-clippy/rust-1.39.0/index.html).
+This includes all lint groups except for nursery, pedantic, and cargo in addition to allowing the following lints:
+`erasing_op`, `never_loop`, `if_same_then_else`.
+
+If you use rustup, feel free to lint locally, otherwise you can just push to CI for automated linting.
+
+```bash
+rustup component add clippy
+cargo clippy
+```
+
 Security
 --------
 
index 22483339d248447e186d4f45b9ef8d4dad4f8dd5..dbd89a2ccdf182f88a6ee32b3ff311456b37b0aa 100644 (file)
@@ -36,4 +36,3 @@ pub mod util;
 pub mod chain;
 pub mod ln;
 pub mod routing;
-
index a1951d6bb62045c9f2aa5466ca34eb86ec2c38e7..379fe19300938127f0602d2c323b532f8604e97c 100644 (file)
@@ -16,6 +16,7 @@
 //! It does not manage routing logic (see routing::router::get_route for that) nor does it manage constructing
 //! on-chain transactions (it only monitors the chain to watch for any force-closes that might
 //! imply it needs to fail HTLCs/payments/channels it manages).
+//!
 
 use bitcoin::blockdata::block::BlockHeader;
 use bitcoin::blockdata::constants::genesis_block;