From ccddaa83c989c23c9af819b2dc60c47dd0abe526 Mon Sep 17 00:00:00 2001 From: Liang-Chi Hsieh Date: Thu, 30 Jun 2022 20:40:13 -0700 Subject: [PATCH] Fix clippy (#1984) --- arrow/src/array/array_dictionary.rs | 2 +- arrow/src/array/array_primitive.rs | 2 +- arrow/src/array/array_string.rs | 2 +- arrow/src/compute/kernels/arithmetic.rs | 4 +--- arrow/src/util/display.rs | 3 ++- parquet/src/encodings/decoding.rs | 4 +--- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arrow/src/array/array_dictionary.rs b/arrow/src/array/array_dictionary.rs index d0222ba9d47..d885a6bc0e5 100644 --- a/arrow/src/array/array_dictionary.rs +++ b/arrow/src/array/array_dictionary.rs @@ -114,7 +114,7 @@ pub struct DictionaryArray { is_ordered: bool, } -impl<'a, K: ArrowPrimitiveType> DictionaryArray { +impl DictionaryArray { /// Attempt to create a new DictionaryArray with a specified keys /// (indexes into the dictionary) and values (dictionary) /// array. Returns an error if there are any keys that are outside diff --git a/arrow/src/array/array_primitive.rs b/arrow/src/array/array_primitive.rs index 6f496562f89..427bda636ee 100644 --- a/arrow/src/array/array_primitive.rs +++ b/arrow/src/array/array_primitive.rs @@ -390,7 +390,7 @@ impl From<&Option<::Native>> } } -impl<'a, T: ArrowPrimitiveType, Ptr: Into>> FromIterator +impl>> FromIterator for PrimitiveArray { fn from_iter>(iter: I) -> Self { diff --git a/arrow/src/array/array_string.rs b/arrow/src/array/array_string.rs index 9e09350f7e6..dba983b0180 100644 --- a/arrow/src/array/array_string.rs +++ b/arrow/src/array/array_string.rs @@ -211,7 +211,7 @@ where } } -impl<'a, Ptr, OffsetSize: OffsetSizeTrait> FromIterator> +impl FromIterator> for GenericStringArray where Ptr: AsRef, diff --git a/arrow/src/compute/kernels/arithmetic.rs b/arrow/src/compute/kernels/arithmetic.rs index 248e8df2770..0189dade2ef 100644 --- a/arrow/src/compute/kernels/arithmetic.rs +++ b/arrow/src/compute/kernels/arithmetic.rs @@ -1071,9 +1071,7 @@ mod tests { fn test_primitive_array_add_mismatched_length() { let a = Int32Array::from(vec![5, 6, 7, 8, 9]); let b = Int32Array::from(vec![6, 7, 8]); - let e = add(&a, &b) - .err() - .expect("should have failed due to different lengths"); + let e = add(&a, &b).expect_err("should have failed due to different lengths"); assert_eq!( "ComputeError(\"Cannot perform math operation on arrays of different length\")", format!("{:?}", e) diff --git a/arrow/src/util/display.rs b/arrow/src/util/display.rs index 6da73e4cff6..220aa59ad40 100644 --- a/arrow/src/util/display.rs +++ b/arrow/src/util/display.rs @@ -19,6 +19,7 @@ //! purposes. See the `pretty` crate for additional functions for //! record batch pretty printing. +use std::fmt::Write; use std::sync::Arc; use crate::array::Array; @@ -208,7 +209,7 @@ macro_rules! make_string_hex { let mut tmp = "".to_string(); for character in array.value($row) { - tmp += &format!("{:02x}", character); + let _ = write!(tmp, "{:02x}", character); } tmp diff --git a/parquet/src/encodings/decoding.rs b/parquet/src/encodings/decoding.rs index 7c95d553234..b33514aaf62 100644 --- a/parquet/src/encodings/decoding.rs +++ b/parquet/src/encodings/decoding.rs @@ -433,7 +433,6 @@ pub struct DeltaBitPackDecoder { initialized: bool, // Header info - /// The number of values in each block block_size: usize, /// The number of values that remain to be read in the current page @@ -444,7 +443,6 @@ pub struct DeltaBitPackDecoder { values_per_mini_block: usize, // Per block info - /// The minimum delta in the block min_delta: T::T, /// The byte offset of the end of the current block @@ -839,7 +837,7 @@ impl DeltaByteArrayDecoder { } } -impl<'m, T: DataType> Decoder for DeltaByteArrayDecoder { +impl Decoder for DeltaByteArrayDecoder { fn set_data(&mut self, data: ByteBufferPtr, num_values: usize) -> Result<()> { match T::get_physical_type() { Type::BYTE_ARRAY | Type::FIXED_LEN_BYTE_ARRAY => {