From 72353ed7a9c5ad2c5af131fee3608d93a858865d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Wed, 15 Sep 2021 16:47:24 +0200 Subject: [PATCH] Clippy all targets (#153) * Fix clippy lints in tests * CI: let clippy lint also tests They deserve equal clippy love, right? :) --- .github/workflows/rust.yml | 2 +- wireguard-control-sys/src/lib.rs | 2 ++ wireguard-control/src/backends/userspace.rs | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7959f0e..8073c0e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -56,4 +56,4 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: -- -D warnings + args: --all-targets -- -D warnings diff --git a/wireguard-control-sys/src/lib.rs b/wireguard-control-sys/src/lib.rs index 8b976c7..0c6218b 100644 --- a/wireguard-control-sys/src/lib.rs +++ b/wireguard-control-sys/src/lib.rs @@ -1,6 +1,8 @@ #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] +// https://github.com/rust-lang/rust-bindgen/issues/1651 +#![allow(deref_nullptr)] #[cfg(target_os = "linux")] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); diff --git a/wireguard-control/src/backends/userspace.rs b/wireguard-control/src/backends/userspace.rs index 1478002..6774aaf 100644 --- a/wireguard-control/src/backends/userspace.rs +++ b/wireguard-control/src/backends/userspace.rs @@ -491,22 +491,22 @@ mod test { #[test] fn test_rng_sanity_private() { let first = Key::generate_private(); - assert!(first.as_bytes() != &[0u8; 32]); + assert!(first.as_bytes() != [0u8; 32]); for _ in 0..100_000 { let key = Key::generate_private(); assert!(first != key); - assert!(key.as_bytes() != &[0u8; 32]); + assert!(key.as_bytes() != [0u8; 32]); } } #[test] fn test_rng_sanity_preshared() { let first = Key::generate_preshared(); - assert!(first.as_bytes() != &[0u8; 32]); + assert!(first.as_bytes() != [0u8; 32]); for _ in 0..100_000 { let key = Key::generate_preshared(); assert!(first != key); - assert!(key.as_bytes() != &[0u8; 32]); + assert!(key.as_bytes() != [0u8; 32]); } } }