diff --git a/arrow-ord/src/comparison.rs b/arrow-ord/src/comparison.rs index c771182f7917..b9274f0eaefb 100644 --- a/arrow-ord/src/comparison.rs +++ b/arrow-ord/src/comparison.rs @@ -2700,7 +2700,7 @@ where } /// Checks if a [`GenericListArray`] contains a value in the [`PrimitiveArray`] -pub fn contains( +pub fn in_list( left: &PrimitiveArray, right: &GenericListArray, ) -> Result @@ -2742,7 +2742,7 @@ where } /// Checks if a [`GenericListArray`] contains a value in the [`GenericStringArray`] -pub fn contains_utf8( +pub fn in_list_utf8( left: &GenericStringArray, right: &ListArray, ) -> Result @@ -3425,7 +3425,7 @@ mod tests { let list_array = LargeListArray::from(list_data); let nulls = Int32Array::from(vec![None, None, None, None]); - let nulls_result = contains(&nulls, &list_array).unwrap(); + let nulls_result = in_list(&nulls, &list_array).unwrap(); assert_eq!( nulls_result .as_any() @@ -3435,7 +3435,7 @@ mod tests { ); let values = Int32Array::from(vec![Some(0), Some(0), Some(0), Some(0)]); - let values_result = contains(&values, &list_array).unwrap(); + let values_result = in_list(&values, &list_array).unwrap(); assert_eq!( values_result .as_any() @@ -3695,7 +3695,7 @@ mod tests { let v: Vec> = vec![None, None, None, None]; let nulls = StringArray::from(v); - let nulls_result = contains_utf8(&nulls, &list_array).unwrap(); + let nulls_result = in_list_utf8(&nulls, &list_array).unwrap(); assert_eq!( nulls_result .as_any() @@ -3710,7 +3710,7 @@ mod tests { Some("Lorem"), Some("Lorem"), ]); - let values_result = contains_utf8(&values, &list_array).unwrap(); + let values_result = in_list_utf8(&values, &list_array).unwrap(); assert_eq!( values_result .as_any() diff --git a/arrow/examples/builders.rs b/arrow/examples/builders.rs index a6d8c563b4ca..250f5c39af10 100644 --- a/arrow/examples/builders.rs +++ b/arrow/examples/builders.rs @@ -15,8 +15,7 @@ // specific language governing permissions and limitations // under the License. -///! Many builders are available to easily create different types of arrow arrays -extern crate arrow; +//! Many builders are available to easily create different types of arrow arrays use std::sync::Arc; diff --git a/arrow/examples/collect.rs b/arrow/examples/collect.rs index 5581186dbe7a..ced4640d600f 100644 --- a/arrow/examples/collect.rs +++ b/arrow/examples/collect.rs @@ -15,8 +15,9 @@ // specific language governing permissions and limitations // under the License. -///! `FromIterator` API is implemented for different array types to easily create them -/// from values. +//! `FromIterator` API is implemented for different array types to easily create them +//! from values. + use arrow::array::Array; use arrow_array::types::Int32Type; use arrow_array::{Float32Array, Int32Array, Int8Array, ListArray}; diff --git a/arrow/examples/dynamic_types.rs b/arrow/examples/dynamic_types.rs index 5470131d6d41..8ec473c76d56 100644 --- a/arrow/examples/dynamic_types.rs +++ b/arrow/examples/dynamic_types.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -///! This example demonstrates dealing with mixed types dynamically at runtime +//! This example demonstrates dealing with mixed types dynamically at runtime use std::sync::Arc; extern crate arrow; diff --git a/arrow/examples/tensor_builder.rs b/arrow/examples/tensor_builder.rs index ca31679e250d..90ad1b4868f7 100644 --- a/arrow/examples/tensor_builder.rs +++ b/arrow/examples/tensor_builder.rs @@ -15,8 +15,7 @@ // specific language governing permissions and limitations // under the License. -///! Tensor builder example -extern crate arrow; +//! Tensor builder example use arrow::array::*; //{Int32BufferBuilder, Float32BufferBuilder}; use arrow::buffer::Buffer; diff --git a/arrow/tests/array_validation.rs b/arrow/tests/array_validation.rs index 67960ada6c98..0d3652a0473a 100644 --- a/arrow/tests/array_validation.rs +++ b/arrow/tests/array_validation.rs @@ -948,8 +948,7 @@ fn test_try_new_sliced_struct() { let struct_array = builder.finish(); let struct_array_slice = struct_array.slice(1, 3); - let cloned = struct_array_slice.clone(); - assert_eq!(&struct_array_slice, &cloned); + assert_eq!(struct_array_slice, struct_array_slice); } #[test] diff --git a/parquet/src/data_type.rs b/parquet/src/data_type.rs index 2e7f73bf0a4f..67d0bad98202 100644 --- a/parquet/src/data_type.rs +++ b/parquet/src/data_type.rs @@ -483,7 +483,7 @@ macro_rules! gen_as_bytes { unsafe { std::slice::from_raw_parts( self_.as_ptr() as *const u8, - std::mem::size_of::<$source_ty>() * self_.len(), + std::mem::size_of_val(self_), ) } } @@ -493,7 +493,7 @@ macro_rules! gen_as_bytes { unsafe fn slice_as_bytes_mut(self_: &mut [Self]) -> &mut [u8] { std::slice::from_raw_parts_mut( self_.as_mut_ptr() as *mut u8, - std::mem::size_of::<$source_ty>() * self_.len(), + std::mem::size_of_val(self_), ) } } @@ -735,7 +735,7 @@ pub(crate) mod private { let raw = unsafe { std::slice::from_raw_parts( values.as_ptr() as *const u8, - std::mem::size_of::<$ty>() * values.len(), + std::mem::size_of_val(values), ) }; writer.write_all(raw)?;