This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-11476-03a380ab68228d4401cad64227d735b4f30fe179 in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
commit a743994d6cd5a7dc94c6f3609c7211576d205f61 Author: Kosta Tarasov <[email protected]> AuthorDate: Thu Oct 15 07:07:49 2026 +0000 Use cargo-shear for dependency checks in CI (#11476) # Which issue does this PR close? closes #11166. # Rationale for this change The existing unused-dependency checks add 54 Clippy invocations across Arrow crates and exclude tests and benchmarks. Replace them with cargo-shear to check dependencies across the repository, including dev-dependencies and Parquet crates. The Machete comparison draft #11477 evaluates detection quality and false positives on the same upstream base. Dependencies remain unchanged so the PR CI runs show each tool's findings directly. # What changes are included in this PR? - Add a job using cargo-shear 1.14.0 with `--deny-warnings`, covering the workspace and both excluded PyArrow crates. The excluded-crate scans still run if an earlier scan finds issues. - Remove the 54 dependency-only Clippy invocations and preserve all 18 regular Clippy checks. - Use the same SHA-pinned checkout and tool installer actions as the existing workflows. - Change only the two workflow files. Findings fail the job without applying fixes or adding ignores; merge requirements are unchanged. # Are these changes tested? `actionlint`, `git diff --check`, and `typos --config typos.toml` pass. On upstream base `e17d04788f`, all three local Shear scans pass with no findings. Machete 0.9.2 reports six false positives on that same base: `bytes`, `futures`, and `tokio` in each of `arrow-csv` and `arrow-json`, all used in reader doctests. The previously observed unused and misplaced dependencies have already been corrected upstream. This PR contains no dependency cleanup. The PR CI run will validate installation and execution in GitHub Actions. Codex assisted with the workflow edits, local validation, and this description. # Are there any user-facing changes? No. This changes CI only. --------- Co-authored-by: Jeffrey Vo <[email protected]> --- .github/workflows/arrow.yml | 144 +++------------------ .github/workflows/integration.yml | 4 - .github/workflows/rust.yml | 24 ++++ arrow-flight/src/lib.rs | 2 - .../src/bin/arrow-file-to-stream.rs | 3 - .../src/bin/arrow-json-integration-test.rs | 3 - .../src/bin/arrow-stream-to-file.rs | 3 - .../src/bin/flight-test-integration-client.rs | 3 - .../src/bin/flight-test-integration-server.rs | 3 - arrow-integration-testing/src/lib.rs | 2 - 10 files changed, 42 insertions(+), 149 deletions(-) diff --git a/.github/workflows/arrow.yml b/.github/workflows/arrow.yml index a23ac9c214..c32dce9228 100644 --- a/.github/workflows/arrow.yml +++ b/.github/workflows/arrow.yml @@ -195,146 +195,38 @@ jobs: - name: Setup Clippy run: rustup component add clippy - name: Clippy arrow-buffer - run: | - mod=arrow-buffer - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-buffer --all-targets --all-features -- -D warnings - name: Clippy arrow-data - run: | - mod=arrow-data - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-data --all-targets --all-features -- -D warnings - name: Clippy arrow-schema - run: | - mod=arrow-schema - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-schema --all-targets --all-features -- -D warnings - name: Clippy arrow-array - run: | - mod=arrow-array - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-array --all-targets --all-features -- -D warnings - name: Clippy arrow-cmp - run: | - mod=arrow-cmp - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-cmp --all-targets --all-features -- -D warnings - name: Clippy arrow-select - run: | - mod=arrow-select - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-select --all-targets --all-features -- -D warnings - name: Clippy arrow-cast - run: | - mod=arrow-cast - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-cast --all-targets --all-features -- -D warnings - name: Clippy arrow-ipc - run: | - mod=arrow-ipc - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-ipc --all-targets --all-features -- -D warnings - name: Clippy arrow-csv - run: | - mod=arrow-csv - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-csv --all-targets --all-features -- -D warnings - name: Clippy arrow-json - run: | - mod=arrow-json - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-json --all-targets --all-features -- -D warnings - name: Clippy arrow-avro - run: | - mod=arrow-avro - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-avro --all-targets --all-features -- -D warnings - name: Clippy arrow-string - run: | - mod=arrow-string - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-string --all-targets --all-features -- -D warnings - name: Clippy arrow-ord - run: | - mod=arrow-ord - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-ord --all-targets --all-features -- -D warnings - name: Clippy arrow-arith - run: | - mod=arrow-arith - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-arith --all-targets --all-features -- -D warnings - name: Clippy arrow-row - run: | - mod=arrow-row - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-row --all-targets --all-features -- -D warnings - name: Clippy arrow - run: | - mod=arrow - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow --all-targets --all-features -- -D warnings - name: Clippy arrow-integration-test - run: | - mod=arrow-integration-test - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-integration-test --all-targets --all-features -- -D warnings - name: Clippy arrow-integration-testing - run: | - mod=arrow-integration-testing - cargo clippy -p "$mod" --all-targets --all-features -- -D warnings - # Dependency checks excluding tests & benches. - cargo clippy -p "$mod" -- -D unused_crate_dependencies - cargo clippy -p "$mod" --all-features -- -D unused_crate_dependencies - cargo clippy -p "$mod" --no-default-features -- -D unused_crate_dependencies + run: cargo clippy -p arrow-integration-testing --all-targets --all-features -- -D warnings diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 658081db89..60358df71a 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -225,10 +225,6 @@ jobs: # Here rather than in arrow.yml's clippy job: that one runs in a # container with no interpreter for pyo3 to link against. cargo clippy -p arrow-pyarrow --all-targets --all-features -- -D warnings - # Dependency check excluding tests & benches. The crate declares no - # default features, so the --no-default-features variant arrow.yml - # also runs would be this same command. - cargo clippy -p arrow-pyarrow --all-features -- -D unused_crate_dependencies - name: Build Python extension run: | source venv/bin/activate diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9a2fe14c84..25882c4c4e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -95,6 +95,30 @@ jobs: - name: Format workspace run: cargo fmt --all -- --check + unused-dependencies: + name: Check unused dependencies + runs-on: ubuntu-latest + container: + image: amd64/rust + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Setup Rust toolchain + uses: ./.github/actions/setup-builder + - name: Install cargo-shear + id: install-shear + uses: taiki-e/install-action@861a07ce7084f55488e375df125cdc99bba60eb7 # v2.87.23 + with: + tool: cargo-shear + - name: Check workspace dependencies + run: cargo shear --deny-warnings + - name: Check arrow-pyarrow-testing dependencies + # Report excluded crates even when an earlier scan finds issues. + if: ${{ !cancelled() && steps.install-shear.outcome == 'success' }} + run: cargo shear --deny-warnings arrow-pyarrow-testing + - name: Check arrow-pyarrow-integration-testing dependencies + if: ${{ !cancelled() && steps.install-shear.outcome == 'success' }} + run: cargo shear --deny-warnings arrow-pyarrow-integration-testing + msrv: name: Verify MSRV (Minimum Supported Rust Version) runs-on: ubuntu-latest diff --git a/arrow-flight/src/lib.rs b/arrow-flight/src/lib.rs index 30efc3b6ea..07d9dcccde 100644 --- a/arrow-flight/src/lib.rs +++ b/arrow-flight/src/lib.rs @@ -51,8 +51,6 @@ #![cfg_attr(docsrs, feature(doc_cfg))] #![allow(rustdoc::invalid_html_tags)] #![warn(missing_docs)] -// The unused_crate_dependencies lint does not work well for crates defining additional examples/bin targets -#![allow(unused_crate_dependencies)] use arrow_ipc::{convert, writer, writer::EncodedData, writer::IpcWriteOptions}; use arrow_schema::{ArrowError, Schema}; diff --git a/arrow-integration-testing/src/bin/arrow-file-to-stream.rs b/arrow-integration-testing/src/bin/arrow-file-to-stream.rs index ca1e25ce98..ed1e994659 100644 --- a/arrow-integration-testing/src/bin/arrow-file-to-stream.rs +++ b/arrow-integration-testing/src/bin/arrow-file-to-stream.rs @@ -17,9 +17,6 @@ //! Converts an Arrow IPC file to an Arrow IPC stream. -// The unused_crate_dependencies lint does not work well for crates defining additional examples/bin targets -#![allow(unused_crate_dependencies)] - use arrow::error::Result; use arrow::ipc::reader::FileReader; use arrow::ipc::writer::StreamWriter; diff --git a/arrow-integration-testing/src/bin/arrow-json-integration-test.rs b/arrow-integration-testing/src/bin/arrow-json-integration-test.rs index 3ee551fe4c..df72961d43 100644 --- a/arrow-integration-testing/src/bin/arrow-json-integration-test.rs +++ b/arrow-integration-testing/src/bin/arrow-json-integration-test.rs @@ -17,9 +17,6 @@ //! Converts between the Arrow IPC file format and the integration test JSON format. -// The unused_crate_dependencies lint does not work well for crates defining additional examples/bin targets -#![allow(unused_crate_dependencies)] - use arrow::error::{ArrowError, Result}; use arrow::ipc::reader::FileReader; use arrow::ipc::writer::FileWriter; diff --git a/arrow-integration-testing/src/bin/arrow-stream-to-file.rs b/arrow-integration-testing/src/bin/arrow-stream-to-file.rs index ed4c289ca9..e6e17ef5dd 100644 --- a/arrow-integration-testing/src/bin/arrow-stream-to-file.rs +++ b/arrow-integration-testing/src/bin/arrow-stream-to-file.rs @@ -17,9 +17,6 @@ //! Converts an Arrow IPC stream to an Arrow IPC file. -// The unused_crate_dependencies lint does not work well for crates defining additional examples/bin targets -#![allow(unused_crate_dependencies)] - use std::io; use arrow::error::Result; diff --git a/arrow-integration-testing/src/bin/flight-test-integration-client.rs b/arrow-integration-testing/src/bin/flight-test-integration-client.rs index c23595be3b..1e8a506189 100644 --- a/arrow-integration-testing/src/bin/flight-test-integration-client.rs +++ b/arrow-integration-testing/src/bin/flight-test-integration-client.rs @@ -17,9 +17,6 @@ //! The client side of the Arrow Flight integration tests. -// The unused_crate_dependencies lint does not work well for crates defining additional examples/bin targets -#![allow(unused_crate_dependencies)] - use arrow_integration_testing::flight_client_scenarios; use clap::Parser; type Error = Box<dyn std::error::Error + Send + Sync + 'static>; diff --git a/arrow-integration-testing/src/bin/flight-test-integration-server.rs b/arrow-integration-testing/src/bin/flight-test-integration-server.rs index 87d1847afd..4052e5c552 100644 --- a/arrow-integration-testing/src/bin/flight-test-integration-server.rs +++ b/arrow-integration-testing/src/bin/flight-test-integration-server.rs @@ -17,9 +17,6 @@ //! The server side of the Arrow Flight integration tests. -// The unused_crate_dependencies lint does not work well for crates defining additional examples/bin targets -#![allow(unused_crate_dependencies)] - use arrow_integration_testing::flight_server_scenarios; use clap::Parser; diff --git a/arrow-integration-testing/src/lib.rs b/arrow-integration-testing/src/lib.rs index a1f7d2a70a..e45804103b 100644 --- a/arrow-integration-testing/src/lib.rs +++ b/arrow-integration-testing/src/lib.rs @@ -17,8 +17,6 @@ //! Common code used in the integration test binaries -// The unused_crate_dependencies lint does not work well for crates defining additional examples/bin targets -#![allow(unused_crate_dependencies)] #![warn(missing_docs)] use serde_json::Value;
