From cde3814683b6784790129c8f4682d89fc194b5ea Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 29 Feb 2024 20:56:46 +0100 Subject: [PATCH 1/3] feat(.github): run cargo clippy on each crate individually > Use cargo-hack to run clippy on each crate individually with its > respective default features only. Can reveal warnings otherwise > hidden given that a plain cargo clippy combines all features of the > workspace. See e.g. https://github.com/mozilla/neqo/pull/1695. --- .github/workflows/check.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2bedb649a..90c3668aa 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -153,7 +153,13 @@ jobs: if: success() || failure() - name: Clippy - run: cargo +${{ matrix.rust-toolchain }} clippy --all-targets -- -D warnings || ${{ matrix.rust-toolchain == 'nightly' }} + run: | + # Use cargo-hack to run clippy on each crate individually with its + # respective default features only. Can reveal warnings otherwise + # hidden given that a plain cargo clippy combines all features of the + # workspace. See e.g. https://github.com/mozilla/neqo/pull/1695. + cargo +${{ matrix.rust-toolchain }} install cargo-hack + cargo +${{ matrix.rust-toolchain }} hack clippy --all-targets -- -D warnings || ${{ matrix.rust-toolchain == 'nightly' }} if: success() || failure() - name: Check rustdoc links From 89814fb34f2b2f820a14f2fee492a13141b67beb Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 29 Feb 2024 12:53:32 +0100 Subject: [PATCH 2/3] fix: feature flag Datagram::into_data `Datagram::into_data` is used in `neqo_common::udp` only. `neqo_common::udp` is behind the `udp` feature. The feature is not part of the crate's default features. Thus a plain `cargo check` rightly complains with: ``` warning: method `into_data` is never used --> neqo-common/src/datagram.rs:58:19 | 20 | impl Datagram { | ------------- method in this implementation ... 58 | pub(crate) fn into_data(self) -> Vec { | ^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default ``` This commit hides `into_data` behind the `udp` feature as well. --- neqo-common/src/datagram.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/neqo-common/src/datagram.rs b/neqo-common/src/datagram.rs index d6ed43bde..04ba1a45a 100644 --- a/neqo-common/src/datagram.rs +++ b/neqo-common/src/datagram.rs @@ -54,6 +54,7 @@ impl Datagram { self.ttl } + #[cfg(feature = "udp")] #[must_use] pub(crate) fn into_data(self) -> Vec { self.d From d9ed682f706e7e84d6203242191bff92ff354f20 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 29 Feb 2024 21:15:06 +0100 Subject: [PATCH 3/3] Install cargo-hack as part of 'Install Rust tools' --- .github/workflows/check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 90c3668aa..4ab080084 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -98,7 +98,7 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - name: Install Rust tools - run: cargo +${{ matrix.rust-toolchain }} binstall --no-confirm cargo-llvm-cov cargo-nextest + run: cargo +${{ matrix.rust-toolchain }} binstall --no-confirm cargo-llvm-cov cargo-nextest cargo-hack # This step might be removed if the distro included a recent enough # version of NSS. Ubuntu 20.04 only has 3.49, which is far too old. @@ -158,7 +158,6 @@ jobs: # respective default features only. Can reveal warnings otherwise # hidden given that a plain cargo clippy combines all features of the # workspace. See e.g. https://github.com/mozilla/neqo/pull/1695. - cargo +${{ matrix.rust-toolchain }} install cargo-hack cargo +${{ matrix.rust-toolchain }} hack clippy --all-targets -- -D warnings || ${{ matrix.rust-toolchain == 'nightly' }} if: success() || failure()