You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by vi...@apache.org on 2022/07/01 03:40:18 UTC

[arrow-rs] branch master updated: Fix clippy (#1984)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new ccddaa83c Fix clippy (#1984)
ccddaa83c is described below

commit ccddaa83c989c23c9af819b2dc60c47dd0abe526
Author: Liang-Chi Hsieh <vi...@gmail.com>
AuthorDate: Thu Jun 30 20:40:13 2022 -0700

    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 d0222ba9d..d885a6bc0 100644
--- a/arrow/src/array/array_dictionary.rs
+++ b/arrow/src/array/array_dictionary.rs
@@ -114,7 +114,7 @@ pub struct DictionaryArray<K: ArrowPrimitiveType> {
     is_ordered: bool,
 }
 
-impl<'a, K: ArrowPrimitiveType> DictionaryArray<K> {
+impl<K: ArrowPrimitiveType> DictionaryArray<K> {
     /// 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 6f496562f..427bda636 100644
--- a/arrow/src/array/array_primitive.rs
+++ b/arrow/src/array/array_primitive.rs
@@ -390,7 +390,7 @@ impl<T: ArrowPrimitiveType> From<&Option<<T as ArrowPrimitiveType>::Native>>
     }
 }
 
-impl<'a, T: ArrowPrimitiveType, Ptr: Into<NativeAdapter<T>>> FromIterator<Ptr>
+impl<T: ArrowPrimitiveType, Ptr: Into<NativeAdapter<T>>> FromIterator<Ptr>
     for PrimitiveArray<T>
 {
     fn from_iter<I: IntoIterator<Item = Ptr>>(iter: I) -> Self {
diff --git a/arrow/src/array/array_string.rs b/arrow/src/array/array_string.rs
index 9e09350f7..dba983b01 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<Option<Ptr>>
+impl<Ptr, OffsetSize: OffsetSizeTrait> FromIterator<Option<Ptr>>
     for GenericStringArray<OffsetSize>
 where
     Ptr: AsRef<str>,
diff --git a/arrow/src/compute/kernels/arithmetic.rs b/arrow/src/compute/kernels/arithmetic.rs
index 248e8df27..0189dade2 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 6da73e4cf..220aa59ad 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 7c95d5532..b33514aaf 100644
--- a/parquet/src/encodings/decoding.rs
+++ b/parquet/src/encodings/decoding.rs
@@ -433,7 +433,6 @@ pub struct DeltaBitPackDecoder<T: DataType> {
     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<T: DataType> {
     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<T: DataType> DeltaByteArrayDecoder<T> {
     }
 }
 
-impl<'m, T: DataType> Decoder<T> for DeltaByteArrayDecoder<T> {
+impl<T: DataType> Decoder<T> for DeltaByteArrayDecoder<T> {
     fn set_data(&mut self, data: ByteBufferPtr, num_values: usize) -> Result<()> {
         match T::get_physical_type() {
             Type::BYTE_ARRAY | Type::FIXED_LEN_BYTE_ARRAY => {