Skip to content

Commit e845411

Browse files
authored
Fix new clippy lints from Rust 1.89 (#8078)
# Which issue does this PR close? # Rationale for this change Clippy is failing on main. Here is an example - https://github.com/apache/arrow-rs/actions/runs/16804746850/job/47594208868 Rust 1.89 was released today and it includes a new clippy version that is more strict about some lints: https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/ # What changes are included in this PR? Fix clippy lints to make CI pass with Rust 1.89 # Are these changes tested? By CI # Are there any user-facing changes?
1 parent a4bcd6d commit e845411

File tree

34 files changed

+74
-104
lines changed

34 files changed

+74
-104
lines changed

arrow-array/src/ffi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ impl ImportedArrowArray<'_> {
525525
unsafe { create_buffer(self.owner.clone(), self.array, 0, buffer_len) }
526526
}
527527

528-
fn dictionary(&self) -> Result<Option<ImportedArrowArray>> {
528+
fn dictionary(&self) -> Result<Option<ImportedArrowArray<'_>>> {
529529
match (self.array.dictionary(), &self.data_type) {
530530
(Some(array), DataType::Dictionary(_, value_type)) => Ok(Some(ImportedArrowArray {
531531
array,

arrow-buffer/src/buffer/boolean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl BooleanBuffer {
104104
/// Returns a `BitChunks` instance which can be used to iterate over
105105
/// this buffer's bits in `u64` chunks
106106
#[inline]
107-
pub fn bit_chunks(&self) -> BitChunks {
107+
pub fn bit_chunks(&self) -> BitChunks<'_> {
108108
BitChunks::new(self.values(), self.offset, self.len)
109109
}
110110

arrow-buffer/src/buffer/immutable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl Buffer {
350350
/// Returns a `BitChunks` instance which can be used to iterate over this buffers bits
351351
/// in larger chunks and starting at arbitrary bit offsets.
352352
/// Note that both `offset` and `length` are measured in bits.
353-
pub fn bit_chunks(&self, offset: usize, len: usize) -> BitChunks {
353+
pub fn bit_chunks(&self, offset: usize, len: usize) -> BitChunks<'_> {
354354
BitChunks::new(self.as_slice(), offset, len)
355355
}
356356

arrow-cast/src/pretty.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,9 +1240,10 @@ mod tests {
12401240
// Pretty formatting
12411241
let opts = FormatOptions::default().with_null("null");
12421242
let opts = opts.with_duration_format(DurationFormat::Pretty);
1243-
let pretty = pretty_format_columns_with_options("pretty", &[array.clone()], &opts)
1244-
.unwrap()
1245-
.to_string();
1243+
let pretty =
1244+
pretty_format_columns_with_options("pretty", std::slice::from_ref(&array), &opts)
1245+
.unwrap()
1246+
.to_string();
12461247

12471248
// Expected output
12481249
let expected_pretty = vec![

arrow-data/src/transform/boolean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use super::{Extend, _MutableArrayData, utils::resize_for_bits};
1919
use crate::bit_mask::set_bits;
2020
use crate::ArrayData;
2121

22-
pub(super) fn build_extend(array: &ArrayData) -> Extend {
22+
pub(super) fn build_extend(array: &ArrayData) -> Extend<'_> {
2323
let values = array.buffers()[0].as_slice();
2424
Box::new(
2525
move |mutable: &mut _MutableArrayData, _, start: usize, len: usize| {

arrow-data/src/transform/fixed_binary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use super::{Extend, _MutableArrayData};
1919
use crate::ArrayData;
2020
use arrow_schema::DataType;
2121

22-
pub(super) fn build_extend(array: &ArrayData) -> Extend {
22+
pub(super) fn build_extend(array: &ArrayData) -> Extend<'_> {
2323
let size = match array.data_type() {
2424
DataType::FixedSizeBinary(i) => *i as usize,
2525
_ => unreachable!(),

arrow-data/src/transform/fixed_size_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use arrow_schema::DataType;
2020

2121
use super::{Extend, _MutableArrayData};
2222

23-
pub(super) fn build_extend(array: &ArrayData) -> Extend {
23+
pub(super) fn build_extend(array: &ArrayData) -> Extend<'_> {
2424
let size = match array.data_type() {
2525
DataType::FixedSizeList(_, i) => *i as usize,
2626
_ => unreachable!(),

arrow-data/src/transform/list.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ use crate::ArrayData;
2323
use arrow_buffer::ArrowNativeType;
2424
use num::{CheckedAdd, Integer};
2525

26-
pub(super) fn build_extend<T: ArrowNativeType + Integer + CheckedAdd>(array: &ArrayData) -> Extend {
26+
pub(super) fn build_extend<T: ArrowNativeType + Integer + CheckedAdd>(
27+
array: &ArrayData,
28+
) -> Extend<'_> {
2729
let offsets = array.buffer::<T>(0);
2830
Box::new(
2931
move |mutable: &mut _MutableArrayData, index: usize, start: usize, len: usize| {

arrow-data/src/transform/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl _MutableArrayData<'_> {
7373
}
7474
}
7575

76-
fn build_extend_null_bits(array: &ArrayData, use_nulls: bool) -> ExtendNullBits {
76+
fn build_extend_null_bits(array: &ArrayData, use_nulls: bool) -> ExtendNullBits<'_> {
7777
if let Some(nulls) = array.nulls() {
7878
let bytes = nulls.validity();
7979
Box::new(move |mutable, start, len| {
@@ -190,7 +190,7 @@ impl std::fmt::Debug for MutableArrayData<'_> {
190190
/// Builds an extend that adds `offset` to the source primitive
191191
/// Additionally validates that `max` fits into the
192192
/// the underlying primitive returning None if not
193-
fn build_extend_dictionary(array: &ArrayData, offset: usize, max: usize) -> Option<Extend> {
193+
fn build_extend_dictionary(array: &ArrayData, offset: usize, max: usize) -> Option<Extend<'_>> {
194194
macro_rules! validate_and_build {
195195
($dt: ty) => {{
196196
let _: $dt = max.try_into().ok()?;
@@ -215,7 +215,7 @@ fn build_extend_dictionary(array: &ArrayData, offset: usize, max: usize) -> Opti
215215
}
216216

217217
/// Builds an extend that adds `buffer_offset` to any buffer indices encountered
218-
fn build_extend_view(array: &ArrayData, buffer_offset: u32) -> Extend {
218+
fn build_extend_view(array: &ArrayData, buffer_offset: u32) -> Extend<'_> {
219219
let views = array.buffer::<u128>(0);
220220
Box::new(
221221
move |mutable: &mut _MutableArrayData, _, start: usize, len: usize| {
@@ -234,7 +234,7 @@ fn build_extend_view(array: &ArrayData, buffer_offset: u32) -> Extend {
234234
)
235235
}
236236

237-
fn build_extend(array: &ArrayData) -> Extend {
237+
fn build_extend(array: &ArrayData) -> Extend<'_> {
238238
match array.data_type() {
239239
DataType::Null => null::build_extend(array),
240240
DataType::Boolean => boolean::build_extend(array),

arrow-data/src/transform/null.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use super::{Extend, _MutableArrayData};
1919
use crate::ArrayData;
2020

21-
pub(super) fn build_extend(_: &ArrayData) -> Extend {
21+
pub(super) fn build_extend(_: &ArrayData) -> Extend<'_> {
2222
Box::new(move |_, _, _, _| {})
2323
}
2424

0 commit comments

Comments
 (0)