This is an automated email from the ASF dual-hosted git repository.

Jefffrey pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 6dc6432f78 More workspace lints: finish `[workspace.lints.rust]` 
(#10551)
6dc6432f78 is described below

commit 6dc6432f787468a007c172ca729aad8bf547b819
Author: Emil Ernerfeldt <[email protected]>
AuthorDate: Wed Aug 5 00:14:13 2026 -0700

    More workspace lints: finish `[workspace.lints.rust]` (#10551)
    
    # Which issue does this PR close?
    No issue in particular
    
    - Follow-up to #10533
    
    # Rationale for this change
    
    #10533 added `[workspace.lints]` with a minimal set of lints.
    
    This fills out `[workspace.lints.rust]` with more lints.
    
    # What changes are included in this PR?
    
    Best reviewed commit by commit!
    
    # Are these changes tested?
    
    By CI
    
    # Are there any user-facing changes?
    
    No public API changed.
---
 Cargo.toml                                        | 20 +++++++++++++------
 arrow-arith/src/numeric.rs                        |  8 ++++----
 arrow-array/src/types.rs                          |  2 +-
 arrow-avro/benches/avro_writer.rs                 |  4 ----
 arrow-avro/benches/decoder.rs                     |  7 -------
 arrow-cast/src/display.rs                         |  2 +-
 arrow-ipc/src/compression.rs                      |  2 +-
 arrow-ipc/src/gen/mod.rs                          | 11 +++++++++++
 arrow-ipc/src/writer.rs                           |  2 +-
 arrow-string/src/binary_like.rs                   |  2 +-
 arrow/benches/aggregate_kernels.rs                |  2 --
 arrow/benches/arithmetic_kernels.rs               |  2 --
 arrow/benches/array_data_validate.rs              |  2 --
 arrow/benches/array_from.rs                       |  1 -
 arrow/benches/array_iter.rs                       |  1 -
 arrow/benches/array_slice.rs                      |  2 --
 arrow/benches/bit_length_kernel.rs                |  2 --
 arrow/benches/bitwise_kernel.rs                   |  2 --
 arrow/benches/boolean_kernels.rs                  |  2 --
 arrow/benches/buffer_bit_ops.rs                   |  2 --
 arrow/benches/buffer_create.rs                    |  2 --
 arrow/benches/builder.rs                          |  4 ----
 arrow/benches/cast_kernels.rs                     |  2 --
 arrow/benches/comparison_kernels.rs               |  1 -
 arrow/benches/concatenate_elements.rs             |  1 -
 arrow/benches/concatenate_kernel.rs               |  1 -
 arrow/benches/csv_reader.rs                       |  3 ---
 arrow/benches/csv_writer.rs                       |  3 ---
 arrow/benches/decimal_validate.rs                 |  2 --
 arrow/benches/equal.rs                            |  2 --
 arrow/benches/filter_kernels.rs                   |  1 -
 arrow/benches/interleave_kernels.rs               |  2 --
 arrow/benches/length_kernel.rs                    |  2 --
 arrow/benches/mutable_array.rs                    |  2 --
 arrow/benches/partition_kernels.rs                |  5 ++---
 arrow/benches/regexp_kernels.rs                   |  2 --
 arrow/benches/row_format.rs                       |  1 -
 arrow/benches/sort_kernel.rs                      |  2 --
 arrow/benches/substring_kernels.rs                |  2 --
 arrow/benches/take_kernels.rs                     |  2 --
 arrow/examples/dynamic_types.rs                   |  2 --
 arrow/examples/read_csv.rs                        |  2 --
 arrow/examples/read_csv_infer_schema.rs           |  2 --
 parquet-variant-compute/src/unshred_variant.rs    |  6 +++---
 parquet-variant/benches/variant_builder.rs        |  2 --
 parquet-variant/benches/variant_validation.rs     |  2 --
 parquet/benches/arrow_writer.rs                   |  3 ---
 parquet/src/arrow/array_reader/primitive_array.rs |  4 ++++
 parquet/src/file/metadata/reader.rs               |  6 +++---
 parquet/src/parquet_thrift.rs                     |  2 +-
 parquet/src/util/bit_util.rs                      | 24 ++++++++++++++++++++++-
 parquet/tests/arrow_reader/statistics.rs          |  3 +--
 parquet_derive/src/lib.rs                         |  3 ---
 53 files changed, 71 insertions(+), 110 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index f317703955..3a2bc6b6ce 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -124,19 +124,27 @@ simdutf8 = { version = "0.1.5", default-features = false }
 #
 # Keep the lists sorted.
 [workspace.lints.rust]
+explicit_outlives_requirements = "warn"
 future_incompatible = { level = "warn", priority = -1 }
 nonstandard_style = { level = "warn", priority = -1 }
 rust_2018_idioms = { level = "warn", priority = -1 }
 rust_2021_prelude_collisions = "warn"
 semicolon_in_expressions_from_macros = "warn"
+trivial_numeric_casts = "warn"
+unexpected_cfgs = "warn"
 unsafe_op_in_unsafe_fn = "warn"
+unused_extern_crates = "warn"
 unused_import_braces = "warn"
-
-# TODO: fix the violations and enable these too. They are all part of 
`rust_2018_idioms`,
-# and each has far too many violations to fix in one go:
-elided_lifetimes_in_paths = "allow"      # ~1200 violations
-explicit_outlives_requirements = "allow" # ~80 violations
-unused_extern_crates = "allow"           # ~60 violations
+unused_lifetimes = "warn"
+
+# Deliberately left off: all the noise of spelling out elided lifetimes and
+# redundant qualifications, without catching anything that matters.
+# `elided_lifetimes_in_paths` is part of `rust_2018_idioms`, so it has to be
+# turned off explicitly; the other two are `allow` by default and are listed
+# only to record the decision.
+elided_lifetimes_in_paths = "allow" # ~600 violations in ~100 files
+trivial_casts = "allow"             # ~2000 violations
+unused_qualifications = "allow"     # ~2000 violations
 
 [workspace.lints.rustdoc]
 all = { level = "warn", priority = -1 }
diff --git a/arrow-arith/src/numeric.rs b/arrow-arith/src/numeric.rs
index 533c6d330b..be6ae21ff5 100644
--- a/arrow-arith/src/numeric.rs
+++ b/arrow-arith/src/numeric.rs
@@ -753,10 +753,10 @@ fn interval_mul_f64(
     const SECONDS_PER_DAY: f64 = SECONDS_IN_DAY as f64;
 
     // Keep integral factors exact instead of round-tripping i64 nanoseconds 
through f64.
-    if factor.fract() == 0. {
-        if let Some(factor) = ToPrimitive::to_i64(&factor) {
-            return IntervalMonthDayNanoType::mul_i64(interval, factor);
-        }
+    if factor.fract() == 0.
+        && let Some(factor) = ToPrimitive::to_i64(&factor)
+    {
+        return IntervalMonthDayNanoType::mul_i64(interval, factor);
     }
 
     // Based on DuckDB's INTERVAL * DOUBLE implementation, which is referenced 
from PostgreSQL's interval_mul:
diff --git a/arrow-array/src/types.rs b/arrow-array/src/types.rs
index a8de9267b3..40cb3fd7fa 100644
--- a/arrow-array/src/types.rs
+++ b/arrow-array/src/types.rs
@@ -1227,7 +1227,7 @@ impl Date64Type {
     /// * `d` - The NaiveDate to convert
     pub fn from_naive_date(d: NaiveDate) -> <Date64Type as 
ArrowPrimitiveType>::Native {
         let epoch = NaiveDate::from_ymd_opt(1970, 1, 1).unwrap();
-        d.sub(epoch).num_milliseconds() as <Date64Type as 
ArrowPrimitiveType>::Native
+        d.sub(epoch).num_milliseconds()
     }
 
     /// Adds the given IntervalYearMonthType to an arrow Date64Type
diff --git a/arrow-avro/benches/avro_writer.rs 
b/arrow-avro/benches/avro_writer.rs
index efb8141985..6ac4e81af2 100644
--- a/arrow-avro/benches/avro_writer.rs
+++ b/arrow-avro/benches/avro_writer.rs
@@ -17,10 +17,6 @@
 
 //! Benchmarks for `arrow-avro` Writer (Avro Object Container File)
 
-extern crate arrow_avro;
-extern crate criterion;
-extern crate once_cell;
-
 use arrow_array::{
     ArrayRef, BinaryArray, BooleanArray, Decimal128Array, Decimal256Array, 
FixedSizeBinaryArray,
     Float32Array, Float64Array, ListArray, PrimitiveArray, RecordBatch, 
StringArray, StructArray,
diff --git a/arrow-avro/benches/decoder.rs b/arrow-avro/benches/decoder.rs
index 7180826b7b..54202fe270 100644
--- a/arrow-avro/benches/decoder.rs
+++ b/arrow-avro/benches/decoder.rs
@@ -18,13 +18,6 @@
 //! Benchmarks for `arrow‑avro` **Decoder**
 //!
 
-extern crate apache_avro;
-extern crate arrow_avro;
-extern crate criterion;
-extern crate num_bigint;
-extern crate once_cell;
-extern crate uuid;
-
 use apache_avro::types::Value;
 use apache_avro::{Decimal, Schema as ApacheSchema, to_avro_datum};
 use arrow_avro::schema::{CONFLUENT_MAGIC, Fingerprint, FingerprintAlgorithm, 
SINGLE_OBJECT_MAGIC};
diff --git a/arrow-cast/src/display.rs b/arrow-cast/src/display.rs
index 0460c0c96b..bacaef46d7 100644
--- a/arrow-cast/src/display.rs
+++ b/arrow-cast/src/display.rs
@@ -802,7 +802,7 @@ macro_rules! temporal_display {
 
             fn write(&self, fmt: &Self::State, idx: usize, f: &mut dyn Write) 
-> FormatResult {
                 let value = self.value(idx);
-                let naive = $convert(value as _).ok_or_else(|| {
+                let naive = $convert(value).ok_or_else(|| {
                     ArrowError::CastError(format!(
                         "Failed to convert {} to temporal for {}",
                         value,
diff --git a/arrow-ipc/src/compression.rs b/arrow-ipc/src/compression.rs
index 311892877b..8154d23ab2 100644
--- a/arrow-ipc/src/compression.rs
+++ b/arrow-ipc/src/compression.rs
@@ -242,7 +242,7 @@ impl CompressionCodec {
         } else if let Ok(decompressed_length) = 
usize::try_from(decompressed_length) {
             // decompress data using the codec
             let input_data = &input[(LENGTH_OF_PREFIX_DATA as usize)..];
-            let v = self.decompress(input_data, decompressed_length as _, 
context)?;
+            let v = self.decompress(input_data, decompressed_length, context)?;
             Buffer::from_vec(v)
         } else {
             return Err(ArrowError::IpcError(format!(
diff --git a/arrow-ipc/src/gen/mod.rs b/arrow-ipc/src/gen/mod.rs
index ceeb6b2c5c..37192354ed 100644
--- a/arrow-ipc/src/gen/mod.rs
+++ b/arrow-ipc/src/gen/mod.rs
@@ -18,6 +18,17 @@
 //! Generated code
 
 #![allow(non_snake_case)]
+// The flatbuffers compiler emits redundant `T: 'a` bounds, and lifetime 
parameters
+// that some of the generated types never use. This file is not regenerated by
+// `regen.sh`, so these attributes survive regeneration of the modules below.
+#![expect(
+    explicit_outlives_requirements,
+    reason = "the flatbuffers compiler emits redundant `T: 'a` bounds"
+)]
+#![expect(
+    unused_lifetimes,
+    reason = "the flatbuffers compiler emits lifetime parameters that some 
generated types never use"
+)]
 
 #[allow(clippy::all)]
 pub mod File;
diff --git a/arrow-ipc/src/writer.rs b/arrow-ipc/src/writer.rs
index ecd0f0f667..6d0d9a7eee 100644
--- a/arrow-ipc/src/writer.rs
+++ b/arrow-ipc/src/writer.rs
@@ -451,7 +451,7 @@ impl IpcWriteOptions {
     #[cfg(feature = "zstd")]
     fn check_zstd_level(self, level: i32) -> Result<Self, ArrowError> {
         let range = zstd::compression_level_range();
-        if !range.contains(&(level as zstd::zstd_safe::CompressionLevel)) {
+        if !range.contains(&level) {
             return Err(ArrowError::InvalidArgumentError(format!(
                 "ZSTD compression level must be between {} and {}, got {}",
                 range.start(),
diff --git a/arrow-string/src/binary_like.rs b/arrow-string/src/binary_like.rs
index 8f8641edb1..a66400aa78 100644
--- a/arrow-string/src/binary_like.rs
+++ b/arrow-string/src/binary_like.rs
@@ -56,7 +56,7 @@ impl std::fmt::Display for Op {
     }
 }
 
-pub(crate) fn binary_apply<'a, 'i, T: BinaryArrayType<'a> + 'a>(
+pub(crate) fn binary_apply<'a, T: BinaryArrayType<'a> + 'a>(
     op: Op,
     l: T,
     l_s: bool,
diff --git a/arrow/benches/aggregate_kernels.rs 
b/arrow/benches/aggregate_kernels.rs
index baf90e2296..74b682d5ce 100644
--- a/arrow/benches/aggregate_kernels.rs
+++ b/arrow/benches/aggregate_kernels.rs
@@ -20,8 +20,6 @@ extern crate criterion;
 use criterion::{Criterion, Throughput};
 use rand::distr::{Distribution, StandardUniform};
 
-extern crate arrow;
-
 use arrow::compute::kernels::aggregate::*;
 use arrow::util::bench_util::*;
 use arrow::{array::*, datatypes::Float32Type};
diff --git a/arrow/benches/arithmetic_kernels.rs 
b/arrow/benches/arithmetic_kernels.rs
index af2db62ccd..fffd370320 100644
--- a/arrow/benches/arithmetic_kernels.rs
+++ b/arrow/benches/arithmetic_kernels.rs
@@ -17,8 +17,6 @@
 
 use criterion::*;
 
-extern crate arrow;
-
 use arrow::compute::kernels::numeric::*;
 use arrow::datatypes::Float32Type;
 use arrow::util::bench_util::*;
diff --git a/arrow/benches/array_data_validate.rs 
b/arrow/benches/array_data_validate.rs
index 33d000d14b..b54b207792 100644
--- a/arrow/benches/array_data_validate.rs
+++ b/arrow/benches/array_data_validate.rs
@@ -19,8 +19,6 @@
 extern crate criterion;
 use criterion::Criterion;
 
-extern crate arrow;
-
 use arrow::{array::*, buffer::Buffer, datatypes::DataType};
 
 fn create_binary_array_data(length: i32) -> ArrayData {
diff --git a/arrow/benches/array_from.rs b/arrow/benches/array_from.rs
index 575a8280f6..9eff2b8fad 100644
--- a/arrow/benches/array_from.rs
+++ b/arrow/benches/array_from.rs
@@ -15,7 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
 #[macro_use]
 extern crate criterion;
 
diff --git a/arrow/benches/array_iter.rs b/arrow/benches/array_iter.rs
index 14738196bf..5a555a133a 100644
--- a/arrow/benches/array_iter.rs
+++ b/arrow/benches/array_iter.rs
@@ -15,7 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
 #[macro_use]
 extern crate criterion;
 
diff --git a/arrow/benches/array_slice.rs b/arrow/benches/array_slice.rs
index a535c80d21..1122a2ed70 100644
--- a/arrow/benches/array_slice.rs
+++ b/arrow/benches/array_slice.rs
@@ -19,8 +19,6 @@
 extern crate criterion;
 use criterion::Criterion;
 
-extern crate arrow;
-
 use arrow::array::*;
 use std::sync::Arc;
 
diff --git a/arrow/benches/bit_length_kernel.rs 
b/arrow/benches/bit_length_kernel.rs
index a8368bf3d2..85a1d69558 100644
--- a/arrow/benches/bit_length_kernel.rs
+++ b/arrow/benches/bit_length_kernel.rs
@@ -19,8 +19,6 @@
 extern crate criterion;
 use criterion::Criterion;
 
-extern crate arrow;
-
 use arrow::{array::*, compute::kernels::length::bit_length};
 use std::hint;
 
diff --git a/arrow/benches/bitwise_kernel.rs b/arrow/benches/bitwise_kernel.rs
index f8a1c6bec1..729d48f627 100644
--- a/arrow/benches/bitwise_kernel.rs
+++ b/arrow/benches/bitwise_kernel.rs
@@ -27,8 +27,6 @@ use criterion::Criterion;
 use rand::RngCore;
 use std::hint;
 
-extern crate arrow;
-
 use arrow::util::bench_util::create_primitive_array;
 use arrow::util::test_util::seedable_rng;
 
diff --git a/arrow/benches/boolean_kernels.rs b/arrow/benches/boolean_kernels.rs
index a7231c031a..34181bede5 100644
--- a/arrow/benches/boolean_kernels.rs
+++ b/arrow/benches/boolean_kernels.rs
@@ -21,8 +21,6 @@ use criterion::Criterion;
 
 use arrow::util::bench_util::create_boolean_array;
 
-extern crate arrow;
-
 use arrow::array::*;
 use arrow::compute::kernels::boolean as boolean_kernels;
 use std::hint;
diff --git a/arrow/benches/buffer_bit_ops.rs b/arrow/benches/buffer_bit_ops.rs
index c569224b0f..2304779c38 100644
--- a/arrow/benches/buffer_bit_ops.rs
+++ b/arrow/benches/buffer_bit_ops.rs
@@ -20,8 +20,6 @@ extern crate criterion;
 
 use criterion::{Criterion, Throughput};
 
-extern crate arrow;
-
 use arrow::buffer::{Buffer, MutableBuffer, buffer_bin_and, buffer_bin_or, 
buffer_unary_not};
 use std::hint;
 
diff --git a/arrow/benches/buffer_create.rs b/arrow/benches/buffer_create.rs
index be73b2ad21..b045bea564 100644
--- a/arrow/benches/buffer_create.rs
+++ b/arrow/benches/buffer_create.rs
@@ -22,8 +22,6 @@ use criterion::Criterion;
 use rand::Rng;
 use rand::distr::Uniform;
 
-extern crate arrow;
-
 use arrow::{
     buffer::{Buffer, MutableBuffer},
     datatypes::ToByteSlice,
diff --git a/arrow/benches/builder.rs b/arrow/benches/builder.rs
index 2374797961..21d4c3baaa 100644
--- a/arrow/benches/builder.rs
+++ b/arrow/benches/builder.rs
@@ -15,10 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
-extern crate criterion;
-extern crate rand;
-
 use std::mem::size_of;
 
 use criterion::*;
diff --git a/arrow/benches/cast_kernels.rs b/arrow/benches/cast_kernels.rs
index 85287a8c40..30c6b86137 100644
--- a/arrow/benches/cast_kernels.rs
+++ b/arrow/benches/cast_kernels.rs
@@ -25,8 +25,6 @@ use std::hint;
 use chrono::DateTime;
 use std::sync::Arc;
 
-extern crate arrow;
-
 use arrow::array::*;
 use arrow::compute::cast;
 use arrow::datatypes::*;
diff --git a/arrow/benches/comparison_kernels.rs 
b/arrow/benches/comparison_kernels.rs
index 3b3e72241c..2c55676873 100644
--- a/arrow/benches/comparison_kernels.rs
+++ b/arrow/benches/comparison_kernels.rs
@@ -15,7 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
 #[macro_use]
 extern crate criterion;
 
diff --git a/arrow/benches/concatenate_elements.rs 
b/arrow/benches/concatenate_elements.rs
index 2e841eb031..fcacbe3284 100644
--- a/arrow/benches/concatenate_elements.rs
+++ b/arrow/benches/concatenate_elements.rs
@@ -15,7 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
 #[macro_use]
 extern crate criterion;
 
diff --git a/arrow/benches/concatenate_kernel.rs 
b/arrow/benches/concatenate_kernel.rs
index a15c82001f..497c2e8f1e 100644
--- a/arrow/benches/concatenate_kernel.rs
+++ b/arrow/benches/concatenate_kernel.rs
@@ -15,7 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
 #[macro_use]
 extern crate criterion;
 use std::sync::Arc;
diff --git a/arrow/benches/csv_reader.rs b/arrow/benches/csv_reader.rs
index 331ff9edd5..092a5eef2b 100644
--- a/arrow/benches/csv_reader.rs
+++ b/arrow/benches/csv_reader.rs
@@ -15,9 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
-extern crate criterion;
-
 use std::io::Cursor;
 use std::sync::Arc;
 
diff --git a/arrow/benches/csv_writer.rs b/arrow/benches/csv_writer.rs
index 030494aaf9..a66ae28f62 100644
--- a/arrow/benches/csv_writer.rs
+++ b/arrow/benches/csv_writer.rs
@@ -15,9 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
-extern crate criterion;
-
 use criterion::*;
 
 use arrow::array::*;
diff --git a/arrow/benches/decimal_validate.rs 
b/arrow/benches/decimal_validate.rs
index 474b937370..db6eb4a14e 100644
--- a/arrow/benches/decimal_validate.rs
+++ b/arrow/benches/decimal_validate.rs
@@ -25,8 +25,6 @@ use arrow::array::{
 use criterion::Criterion;
 use rand::Rng;
 
-extern crate arrow;
-
 use arrow_buffer::i256;
 
 fn validate_decimal32_array(array: Decimal32Array) {
diff --git a/arrow/benches/equal.rs b/arrow/benches/equal.rs
index 0d6075f392..8a3825970a 100644
--- a/arrow/benches/equal.rs
+++ b/arrow/benches/equal.rs
@@ -22,8 +22,6 @@
 extern crate criterion;
 use criterion::Criterion;
 
-extern crate arrow;
-
 use arrow::util::bench_util::*;
 use arrow::{array::*, datatypes::Float32Type};
 use std::hint;
diff --git a/arrow/benches/filter_kernels.rs b/arrow/benches/filter_kernels.rs
index ff117f9d63..0e0afba6eb 100644
--- a/arrow/benches/filter_kernels.rs
+++ b/arrow/benches/filter_kernels.rs
@@ -14,7 +14,6 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-extern crate arrow;
 
 use std::sync::Arc;
 
diff --git a/arrow/benches/interleave_kernels.rs 
b/arrow/benches/interleave_kernels.rs
index 6ef38d9a71..6eb07af9d3 100644
--- a/arrow/benches/interleave_kernels.rs
+++ b/arrow/benches/interleave_kernels.rs
@@ -23,8 +23,6 @@ use std::ops::Range;
 
 use rand::Rng;
 
-extern crate arrow;
-
 use arrow::datatypes::*;
 use arrow::util::test_util::seedable_rng;
 use arrow::{array::*, util::bench_util::*};
diff --git a/arrow/benches/length_kernel.rs b/arrow/benches/length_kernel.rs
index 338dd58952..ae7b562b26 100644
--- a/arrow/benches/length_kernel.rs
+++ b/arrow/benches/length_kernel.rs
@@ -19,8 +19,6 @@
 extern crate criterion;
 use criterion::Criterion;
 
-extern crate arrow;
-
 use arrow::array::*;
 use arrow::compute::kernels::length::length;
 use std::hint;
diff --git a/arrow/benches/mutable_array.rs b/arrow/benches/mutable_array.rs
index 9b76f74b6c..4e5d443d25 100644
--- a/arrow/benches/mutable_array.rs
+++ b/arrow/benches/mutable_array.rs
@@ -21,8 +21,6 @@ use criterion::Criterion;
 
 use rand::Rng;
 
-extern crate arrow;
-
 use arrow::util::test_util::seedable_rng;
 use arrow::{array::*, util::bench_util::create_string_array};
 
diff --git a/arrow/benches/partition_kernels.rs 
b/arrow/benches/partition_kernels.rs
index f150d155c3..0d3052b261 100644
--- a/arrow/benches/partition_kernels.rs
+++ b/arrow/benches/partition_kernels.rs
@@ -17,9 +17,6 @@
 
 #[macro_use]
 extern crate criterion;
-use criterion::Criterion;
-use std::sync::Arc;
-extern crate arrow;
 use arrow::compute::kernels::sort::{SortColumn, lexsort};
 use arrow::util::bench_util::*;
 use arrow::{
@@ -27,8 +24,10 @@ use arrow::{
     datatypes::{Float64Type, UInt8Type},
 };
 use arrow_ord::partition::partition;
+use criterion::Criterion;
 use rand::distr::{Distribution, StandardUniform};
 use std::hint;
+use std::sync::Arc;
 
 fn create_array<T: ArrowPrimitiveType>(size: usize, with_nulls: bool) -> 
ArrayRef
 where
diff --git a/arrow/benches/regexp_kernels.rs b/arrow/benches/regexp_kernels.rs
index c48cf7de02..f2483f29f4 100644
--- a/arrow/benches/regexp_kernels.rs
+++ b/arrow/benches/regexp_kernels.rs
@@ -19,8 +19,6 @@
 extern crate criterion;
 use criterion::Criterion;
 
-extern crate arrow;
-
 use arrow::array::*;
 use arrow::compute::kernels::regexp::*;
 use arrow::util::bench_util::*;
diff --git a/arrow/benches/row_format.rs b/arrow/benches/row_format.rs
index 6615a4d230..caa06dc07e 100644
--- a/arrow/benches/row_format.rs
+++ b/arrow/benches/row_format.rs
@@ -17,7 +17,6 @@
 
 #[macro_use]
 extern crate criterion;
-extern crate core;
 
 use arrow::array::ArrayRef;
 use arrow::datatypes::{Int64Type, UInt64Type};
diff --git a/arrow/benches/sort_kernel.rs b/arrow/benches/sort_kernel.rs
index 408d55b5cc..b8cbb1581d 100644
--- a/arrow/benches/sort_kernel.rs
+++ b/arrow/benches/sort_kernel.rs
@@ -21,8 +21,6 @@ use criterion::Criterion;
 
 use std::sync::Arc;
 
-extern crate arrow;
-
 use arrow::compute::{SortColumn, lexsort, sort, sort_to_indices};
 use arrow::datatypes::{Int16Type, Int32Type};
 use arrow::util::bench_util::*;
diff --git a/arrow/benches/substring_kernels.rs 
b/arrow/benches/substring_kernels.rs
index a3b58988c4..da6a34fa7d 100644
--- a/arrow/benches/substring_kernels.rs
+++ b/arrow/benches/substring_kernels.rs
@@ -19,8 +19,6 @@
 extern crate criterion;
 use criterion::Criterion;
 
-extern crate arrow;
-
 use arrow::array::*;
 use arrow::compute::kernels::substring::*;
 use arrow::util::bench_util::*;
diff --git a/arrow/benches/take_kernels.rs b/arrow/benches/take_kernels.rs
index 5eb9d4fde1..743df22e17 100644
--- a/arrow/benches/take_kernels.rs
+++ b/arrow/benches/take_kernels.rs
@@ -21,8 +21,6 @@ use criterion::Criterion;
 
 use rand::Rng;
 
-extern crate arrow;
-
 use arrow::compute::{TakeOptions, take, take_record_batch};
 use arrow::datatypes::*;
 use arrow::record_batch::RecordBatch;
diff --git a/arrow/examples/dynamic_types.rs b/arrow/examples/dynamic_types.rs
index df5fe5ae65..6405acdf15 100644
--- a/arrow/examples/dynamic_types.rs
+++ b/arrow/examples/dynamic_types.rs
@@ -18,8 +18,6 @@
 //! This example demonstrates dealing with mixed types dynamically at runtime
 use std::sync::Arc;
 
-extern crate arrow;
-
 use arrow::array::*;
 use arrow::datatypes::*;
 use arrow::error::Result;
diff --git a/arrow/examples/read_csv.rs b/arrow/examples/read_csv.rs
index 60545a6e52..8b26fd0609 100644
--- a/arrow/examples/read_csv.rs
+++ b/arrow/examples/read_csv.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
-
 use std::fs::File;
 use std::sync::Arc;
 
diff --git a/arrow/examples/read_csv_infer_schema.rs 
b/arrow/examples/read_csv_infer_schema.rs
index bd3c1c6a46..a2e41c7f69 100644
--- a/arrow/examples/read_csv_infer_schema.rs
+++ b/arrow/examples/read_csv_infer_schema.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate arrow;
-
 use arrow::csv;
 use arrow::util::pretty::print_batches;
 use arrow_csv::reader::Format;
diff --git a/parquet-variant-compute/src/unshred_variant.rs 
b/parquet-variant-compute/src/unshred_variant.rs
index 08c58fe0f5..f9e8464296 100644
--- a/parquet-variant-compute/src/unshred_variant.rs
+++ b/parquet-variant-compute/src/unshred_variant.rs
@@ -207,13 +207,13 @@ impl<'a> UnshredVariantRowBuilder<'a> {
             DataType::Float32 => primitive_builder!(PrimitiveFloat32, 
as_primitive),
             DataType::Float64 => primitive_builder!(PrimitiveFloat64, 
as_primitive),
             DataType::Decimal32(p, s) if 
VariantDecimal4::is_valid_precision_and_scale(p, s) => {
-                Self::Decimal32(DecimalUnshredRowBuilder::new(value, 
typed_value, *s as _))
+                Self::Decimal32(DecimalUnshredRowBuilder::new(value, 
typed_value, *s))
             }
             DataType::Decimal64(p, s) if 
VariantDecimal8::is_valid_precision_and_scale(p, s) => {
-                Self::Decimal64(DecimalUnshredRowBuilder::new(value, 
typed_value, *s as _))
+                Self::Decimal64(DecimalUnshredRowBuilder::new(value, 
typed_value, *s))
             }
             DataType::Decimal128(p, s) if 
VariantDecimal16::is_valid_precision_and_scale(p, s) => {
-                Self::Decimal128(DecimalUnshredRowBuilder::new(value, 
typed_value, *s as _))
+                Self::Decimal128(DecimalUnshredRowBuilder::new(value, 
typed_value, *s))
             }
             DataType::Decimal32(_, _)
             | DataType::Decimal64(_, _)
diff --git a/parquet-variant/benches/variant_builder.rs 
b/parquet-variant/benches/variant_builder.rs
index 420fa583ee..6bfdb5298b 100644
--- a/parquet-variant/benches/variant_builder.rs
+++ b/parquet-variant/benches/variant_builder.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate parquet_variant;
-
 use criterion::*;
 
 use parquet_variant::{Variant, VariantBuilder};
diff --git a/parquet-variant/benches/variant_validation.rs 
b/parquet-variant/benches/variant_validation.rs
index dcf7681a76..dd4d81830a 100644
--- a/parquet-variant/benches/variant_validation.rs
+++ b/parquet-variant/benches/variant_validation.rs
@@ -15,8 +15,6 @@
 // specific language governing permissions and limitations
 // under the License.
 
-extern crate parquet_variant;
-
 use criterion::*;
 
 use parquet_variant::{Variant, VariantBuilder};
diff --git a/parquet/benches/arrow_writer.rs b/parquet/benches/arrow_writer.rs
index f7376b944d..0e9900ee2f 100644
--- a/parquet/benches/arrow_writer.rs
+++ b/parquet/benches/arrow_writer.rs
@@ -22,9 +22,6 @@ use criterion::{Bencher, Criterion, Throughput};
 use parquet::arrow::ArrowWriter;
 use parquet::basic::{Compression, Encoding, ZstdLevel};
 
-extern crate arrow;
-extern crate parquet;
-
 use std::hint::black_box;
 use std::io::Empty;
 use std::sync::Arc;
diff --git a/parquet/src/arrow/array_reader/primitive_array.rs 
b/parquet/src/arrow/array_reader/primitive_array.rs
index a6581aea93..eb3745c5bb 100644
--- a/parquet/src/arrow/array_reader/primitive_array.rs
+++ b/parquet/src/arrow/array_reader/primitive_array.rs
@@ -671,6 +671,10 @@ mod tests {
                     ;
 
                 // create expected array as primitive, and cast to result type
+                #[expect(
+                    trivial_numeric_casts,
+                    reason = "the cast is a no-op when the source and result 
types are the same"
+                )]
                 let expected = PrimitiveArray::<$result_arrow_cast_type>::from(
                     data[0..50]
                         .iter()
diff --git a/parquet/src/file/metadata/reader.rs 
b/parquet/src/file/metadata/reader.rs
index 3f0c2abeab..78414ffdcb 100644
--- a/parquet/src/file/metadata/reader.rs
+++ b/parquet/src/file/metadata/reader.rs
@@ -647,7 +647,7 @@ impl ParquetMetaDataReader {
     ) -> Result<(ParquetMetaData, Option<(usize, Bytes)>)> {
         let prefetch = self.get_prefetch_size();
 
-        let suffix = fetch.fetch_suffix(prefetch as _).await?;
+        let suffix = fetch.fetch_suffix(prefetch).await?;
         let suffix_len = suffix.len();
 
         if suffix_len < FOOTER_SIZE {
@@ -1052,10 +1052,10 @@ mod async_tests {
     }
 
     fn read_range(file: &mut File, range: Range<u64>) -> Result<Bytes> {
-        file.seek(SeekFrom::Start(range.start as _))?;
+        file.seek(SeekFrom::Start(range.start))?;
         let len = range.end - range.start;
         let mut buf = Vec::with_capacity(len.try_into().unwrap());
-        file.take(len as _).read_to_end(&mut buf)?;
+        file.take(len).read_to_end(&mut buf)?;
         Ok(buf.into())
     }
 
diff --git a/parquet/src/parquet_thrift.rs b/parquet/src/parquet_thrift.rs
index b8463ccc65..84d6825f50 100644
--- a/parquet/src/parquet_thrift.rs
+++ b/parquet/src/parquet_thrift.rs
@@ -893,7 +893,7 @@ impl<W: Write> ThriftCompactOutputProtocol<W> {
 
     /// Write a zig-zag encoded `i64` value.
     pub(crate) fn write_i64(&mut self, val: i64) -> Result<()> {
-        self.write_zig_zag(val as _)
+        self.write_zig_zag(val)
     }
 
     /// Write a double value.
diff --git a/parquet/src/util/bit_util.rs b/parquet/src/util/bit_util.rs
index b8ee659678..468d7895c8 100644
--- a/parquet/src/util/bit_util.rs
+++ b/parquet/src/util/bit_util.rs
@@ -139,7 +139,29 @@ macro_rules! from_bitpacked_delegate {
 }
 
 from_le_bytes! { u8, u16, u32, u64, i8, i16, i32, i64 }
-from_bitpacked!(u8 => unpack8, u16 => unpack16, u32 => unpack32, u64 => 
unpack64);
+from_bitpacked!(u8 => unpack8, u16 => unpack16, u32 => unpack32);
+
+// `u64` is written out by hand: the `as` cast the macro uses would be a no-op 
here,
+// and it is the only instantiation for which that is true.
+impl FromBitpacked for u64 {
+    const BIT_CAPACITY: usize = std::mem::size_of::<u64>() * 8;
+    // this has to match the signature of the unpack* functions
+    const BATCH_SIZE: usize = std::mem::size_of::<u64>() * 8;
+
+    #[inline]
+    fn from_u64(v: u64) -> Self {
+        v
+    }
+
+    #[inline]
+    fn unpack_batch(input: &[u8], output: &mut [Self], num_bits: usize) {
+        unpack64(
+            input,
+            (&mut output[..Self::BATCH_SIZE]).try_into().unwrap(),
+            num_bits,
+        )
+    }
+}
 from_bitpacked_delegate!(i8 => u8, i16 => u16, i32 => u32, i64 => u64);
 
 impl FromBitpacked for bool {
diff --git a/parquet/tests/arrow_reader/statistics.rs 
b/parquet/tests/arrow_reader/statistics.rs
index 173361f56f..0bc61ba108 100644
--- a/parquet/tests/arrow_reader/statistics.rs
+++ b/parquet/tests/arrow_reader/statistics.rs
@@ -75,8 +75,7 @@ impl Int64Case {
     fn make_int64_batches_with_null(&self) -> RecordBatch {
         let schema = Arc::new(Schema::new(vec![Field::new("i64", 
DataType::Int64, true)]));
 
-        let v64: Vec<i64> =
-            (self.no_null_values_start as _..self.no_null_values_end as 
_).collect();
+        let v64: Vec<i64> = 
(self.no_null_values_start..self.no_null_values_end).collect();
 
         RecordBatch::try_new(
             schema,
diff --git a/parquet_derive/src/lib.rs b/parquet_derive/src/lib.rs
index a29e57016a..34cb1c8dd8 100644
--- a/parquet_derive/src/lib.rs
+++ b/parquet_derive/src/lib.rs
@@ -26,9 +26,6 @@
 #![warn(missing_docs)]
 #![recursion_limit = "128"]
 
-extern crate proc_macro;
-extern crate proc_macro2;
-extern crate syn;
 #[macro_use]
 extern crate quote;
 

Reply via email to