Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arrow-array/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl ImportedArrowArray<'_> {
unsafe { create_buffer(self.owner.clone(), self.array, 0, buffer_len) }
}

fn dictionary(&self) -> Result<Option<ImportedArrowArray>> {
fn dictionary(&self) -> Result<Option<ImportedArrowArray<'_>>> {
match (self.array.dictionary(), &self.data_type) {
(Some(array), DataType::Dictionary(_, value_type)) => Ok(Some(ImportedArrowArray {
array,
Expand Down
2 changes: 1 addition & 1 deletion arrow-buffer/src/buffer/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl BooleanBuffer {
/// Returns a `BitChunks` instance which can be used to iterate over
/// this buffer's bits in `u64` chunks
#[inline]
pub fn bit_chunks(&self) -> BitChunks {
pub fn bit_chunks(&self) -> BitChunks<'_> {
BitChunks::new(self.values(), self.offset, self.len)
}

Expand Down
2 changes: 1 addition & 1 deletion arrow-buffer/src/buffer/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl Buffer {
/// Returns a `BitChunks` instance which can be used to iterate over this buffers bits
/// in larger chunks and starting at arbitrary bit offsets.
/// Note that both `offset` and `length` are measured in bits.
pub fn bit_chunks(&self, offset: usize, len: usize) -> BitChunks {
pub fn bit_chunks(&self, offset: usize, len: usize) -> BitChunks<'_> {
BitChunks::new(self.as_slice(), offset, len)
}

Expand Down
7 changes: 4 additions & 3 deletions arrow-cast/src/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1240,9 +1240,10 @@ mod tests {
// Pretty formatting
let opts = FormatOptions::default().with_null("null");
let opts = opts.with_duration_format(DurationFormat::Pretty);
let pretty = pretty_format_columns_with_options("pretty", &[array.clone()], &opts)
.unwrap()
.to_string();
let pretty =
pretty_format_columns_with_options("pretty", std::slice::from_ref(&array), &opts)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoiding the clone seems good to me

.unwrap()
.to_string();

// Expected output
let expected_pretty = vec![
Expand Down
2 changes: 1 addition & 1 deletion arrow-data/src/transform/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use super::{Extend, _MutableArrayData, utils::resize_for_bits};
use crate::bit_mask::set_bits;
use crate::ArrayData;

pub(super) fn build_extend(array: &ArrayData) -> Extend {
pub(super) fn build_extend(array: &ArrayData) -> Extend<'_> {
let values = array.buffers()[0].as_slice();
Box::new(
move |mutable: &mut _MutableArrayData, _, start: usize, len: usize| {
Expand Down
2 changes: 1 addition & 1 deletion arrow-data/src/transform/fixed_binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use super::{Extend, _MutableArrayData};
use crate::ArrayData;
use arrow_schema::DataType;

pub(super) fn build_extend(array: &ArrayData) -> Extend {
pub(super) fn build_extend(array: &ArrayData) -> Extend<'_> {
let size = match array.data_type() {
DataType::FixedSizeBinary(i) => *i as usize,
_ => unreachable!(),
Expand Down
2 changes: 1 addition & 1 deletion arrow-data/src/transform/fixed_size_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use arrow_schema::DataType;

use super::{Extend, _MutableArrayData};

pub(super) fn build_extend(array: &ArrayData) -> Extend {
pub(super) fn build_extend(array: &ArrayData) -> Extend<'_> {
let size = match array.data_type() {
DataType::FixedSizeList(_, i) => *i as usize,
_ => unreachable!(),
Expand Down
4 changes: 3 additions & 1 deletion arrow-data/src/transform/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ use crate::ArrayData;
use arrow_buffer::ArrowNativeType;
use num::{CheckedAdd, Integer};

pub(super) fn build_extend<T: ArrowNativeType + Integer + CheckedAdd>(array: &ArrayData) -> Extend {
pub(super) fn build_extend<T: ArrowNativeType + Integer + CheckedAdd>(
array: &ArrayData,
) -> Extend<'_> {
let offsets = array.buffer::<T>(0);
Box::new(
move |mutable: &mut _MutableArrayData, index: usize, start: usize, len: usize| {
Expand Down
8 changes: 4 additions & 4 deletions arrow-data/src/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl _MutableArrayData<'_> {
}
}

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

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

fn build_extend(array: &ArrayData) -> Extend {
fn build_extend(array: &ArrayData) -> Extend<'_> {
match array.data_type() {
DataType::Null => null::build_extend(array),
DataType::Boolean => boolean::build_extend(array),
Expand Down
2 changes: 1 addition & 1 deletion arrow-data/src/transform/null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use super::{Extend, _MutableArrayData};
use crate::ArrayData;

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

Expand Down
4 changes: 2 additions & 2 deletions arrow-data/src/transform/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::ops::Add;

use super::{Extend, _MutableArrayData};

pub(super) fn build_extend<T: ArrowNativeType>(array: &ArrayData) -> Extend {
pub(super) fn build_extend<T: ArrowNativeType>(array: &ArrayData) -> Extend<'_> {
let values = array.buffer::<T>(0);
Box::new(
move |mutable: &mut _MutableArrayData, _, start: usize, len: usize| {
Expand All @@ -33,7 +33,7 @@ pub(super) fn build_extend<T: ArrowNativeType>(array: &ArrayData) -> Extend {
)
}

pub(super) fn build_extend_with_offset<T>(array: &ArrayData, offset: T) -> Extend
pub(super) fn build_extend_with_offset<T>(array: &ArrayData, offset: T) -> Extend<'_>
where
T: ArrowNativeType + Add<Output = T>,
{
Expand Down
2 changes: 1 addition & 1 deletion arrow-data/src/transform/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fn process_extends_batch<T: ArrowNativeType>(
/// Returns a function that extends the run encoded array.
///
/// It finds the physical indices in the source array that correspond to the logical range to copy, and adjusts the runs to the logical indices of the array to extend. The values are copied from the source array to the destination array verbatim.
pub fn build_extend(array: &ArrayData) -> Extend {
pub fn build_extend(array: &ArrayData) -> Extend<'_> {
Box::new(
move |mutable: &mut _MutableArrayData, array_idx: usize, start: usize, len: usize| {
if len == 0 {
Expand Down
2 changes: 1 addition & 1 deletion arrow-data/src/transform/structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use super::{Extend, _MutableArrayData};
use crate::ArrayData;

pub(super) fn build_extend(_: &ArrayData) -> Extend {
pub(super) fn build_extend(_: &ArrayData) -> Extend<'_> {
Box::new(
move |mutable: &mut _MutableArrayData, index: usize, start: usize, len: usize| {
mutable
Expand Down
4 changes: 2 additions & 2 deletions arrow-data/src/transform/union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use super::{Extend, _MutableArrayData};
use crate::ArrayData;

pub(super) fn build_extend_sparse(array: &ArrayData) -> Extend {
pub(super) fn build_extend_sparse(array: &ArrayData) -> Extend<'_> {
let type_ids = array.buffer::<i8>(0);

Box::new(
Expand All @@ -36,7 +36,7 @@ pub(super) fn build_extend_sparse(array: &ArrayData) -> Extend {
)
}

pub(super) fn build_extend_dense(array: &ArrayData) -> Extend {
pub(super) fn build_extend_dense(array: &ArrayData) -> Extend<'_> {
let type_ids = array.buffer::<i8>(0);
let offsets = array.buffer::<i32>(1);
let arrow_schema::DataType::Union(src_fields, _) = array.data_type() else {
Expand Down
2 changes: 1 addition & 1 deletion arrow-data/src/transform/variable_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn extend_offset_values<T: ArrowNativeType + AsPrimitive<usize>>(

pub(super) fn build_extend<T: ArrowNativeType + Integer + CheckedAdd + AsPrimitive<usize>>(
array: &ArrayData,
) -> Extend {
) -> Extend<'_> {
let offsets = array.buffer::<T>(0);
let values = array.buffers()[1].as_slice();
Box::new(
Expand Down
2 changes: 1 addition & 1 deletion arrow-flight/src/sql/metadata/sql_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ pub struct GetSqlInfoBuilder<'a> {

impl CommandGetSqlInfo {
/// Create a builder suitable for constructing a response
pub fn into_builder(self, infos: &SqlInfoData) -> GetSqlInfoBuilder {
pub fn into_builder(self, infos: &SqlInfoData) -> GetSqlInfoBuilder<'_> {
GetSqlInfoBuilder {
info: self.info,
infos,
Expand Down
2 changes: 1 addition & 1 deletion arrow-flight/src/sql/metadata/xdbc_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ pub struct GetXdbcTypeInfoBuilder<'a> {

impl CommandGetXdbcTypeInfo {
/// Create a builder suitable for constructing a response
pub fn into_builder(self, infos: &XdbcTypeInfoData) -> GetXdbcTypeInfoBuilder {
pub fn into_builder(self, infos: &XdbcTypeInfoData) -> GetXdbcTypeInfoBuilder<'_> {
GetXdbcTypeInfoBuilder {
data_type: self.data_type,
infos,
Expand Down
1 change: 1 addition & 0 deletions arrow-ipc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mod compression;
#[allow(clippy::redundant_static_lifetimes)]
#[allow(clippy::redundant_field_names)]
#[allow(non_camel_case_types)]
#[allow(mismatched_lifetime_syntaxes)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lint is ignored because this is all generated code

#[allow(missing_docs)] // Because this is autogenerated
pub mod gen;

Expand Down
2 changes: 1 addition & 1 deletion arrow-ipc/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ fn read_block<R: Read + Seek>(mut reader: R, block: &Block) -> Result<Buffer, Ar
/// Parse an encapsulated message
///
/// <https://arrow.apache.org/docs/format/Columnar.html#encapsulated-message-format>
fn parse_message(buf: &[u8]) -> Result<Message, ArrowError> {
fn parse_message(buf: &[u8]) -> Result<Message<'_>, ArrowError> {
let buf = match buf[..4] == CONTINUATION_MARKER {
true => &buf[8..],
false => &buf[4..],
Expand Down
10 changes: 7 additions & 3 deletions arrow-row/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ impl Codec {
},
_ => unreachable!(),
};
let rows = converter.convert_columns(&[values.clone()])?;
let rows = converter.convert_columns(std::slice::from_ref(values))?;
Ok(Encoder::RunEndEncoded(rows))
}
}
Expand Down Expand Up @@ -3141,7 +3141,9 @@ mod tests {

for array in arrays.iter() {
rows.clear();
converter.append(&mut rows, &[array.clone()]).unwrap();
converter
.append(&mut rows, std::slice::from_ref(array))
.unwrap();
let back = converter.convert_rows(&rows).unwrap();
assert_eq!(&back[0], array);
}
Expand Down Expand Up @@ -3179,7 +3181,9 @@ mod tests {

rows.clear();
let array = Arc::new(dict_array) as ArrayRef;
converter.append(&mut rows, &[array.clone()]).unwrap();
converter
.append(&mut rows, std::slice::from_ref(&array))
.unwrap();
let back = converter.convert_rows(&rows).unwrap();

dictionary_eq(&back[0], &array);
Expand Down
2 changes: 1 addition & 1 deletion arrow/examples/dynamic_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn main() -> Result<()> {
// build a record batch
let batch = RecordBatch::try_new(Arc::new(schema), vec![Arc::new(id), Arc::new(nested)])?;

print_batches(&[batch.clone()]).unwrap();
print_batches(std::slice::from_ref(&batch)).unwrap();

process(&batch);
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion parquet-variant-compute/src/variant_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl VariantArray {
///
/// Note: Does not do deep validation of the [`Variant`], so it is up to the
/// caller to ensure that the metadata and value were constructed correctly.
pub fn value(&self, index: usize) -> Variant {
pub fn value(&self, index: usize) -> Variant<'_, '_> {
let metadata = self.metadata_field().as_binary_view().value(index);
let value = self.value_field().as_binary_view().value(index);
Variant::new(metadata, value)
Expand Down
6 changes: 3 additions & 3 deletions parquet-variant-compute/src/variant_array_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl VariantArrayBuilder {
/// assert_eq!(variant_array.value(0), Variant::from("Hello, World!"));
/// assert!(variant_array.value(1).as_object().is_some());
/// ```
pub fn variant_builder(&mut self) -> VariantArrayVariantBuilder {
pub fn variant_builder(&mut self) -> VariantArrayVariantBuilder<'_> {
// append directly into the metadata and value buffers
let metadata_buffer = std::mem::take(&mut self.metadata_buffer);
let value_buffer = std::mem::take(&mut self.value_buffer);
Expand Down Expand Up @@ -222,11 +222,11 @@ impl<'a> VariantBuilderExt for VariantArrayVariantBuilder<'a> {
self.variant_builder.append_value(value);
}

fn new_list(&mut self) -> ListBuilder {
fn new_list(&mut self) -> ListBuilder<'_> {
self.variant_builder.new_list()
}

fn new_object(&mut self) -> ObjectBuilder {
fn new_object(&mut self) -> ObjectBuilder<'_> {
self.variant_builder.new_object()
}
}
Expand Down
4 changes: 2 additions & 2 deletions parquet-variant-json/src/from_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ impl VariantBuilderExt for ObjectFieldBuilder<'_, '_, '_> {
self.builder.insert(self.key, value);
}

fn new_list(&mut self) -> ListBuilder {
fn new_list(&mut self) -> ListBuilder<'_> {
self.builder.new_list(self.key)
}

fn new_object(&mut self) -> ObjectBuilder {
fn new_object(&mut self) -> ObjectBuilder<'_> {
self.builder.new_object(self.key)
}
}
Expand Down
Loading
Loading