You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2022/02/16 13:41:55 UTC

[arrow-rs] branch master updated: Enable more lints (#1315)

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

alamb 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 c26a0a1  Enable more lints (#1315)
c26a0a1 is described below

commit c26a0a1a5ecac9884d037764665fd4c98622fe88
Author: Sergey Glushchenko <gs...@gmail.com>
AuthorDate: Wed Feb 16 14:41:38 2022 +0100

    Enable more lints (#1315)
---
 .github/workflows/rust.yml              |  2 +-
 arrow/src/buffer/ops.rs                 | 20 ++++++++++----------
 arrow/src/compute/kernels/arithmetic.rs | 10 +++++-----
 arrow/src/compute/kernels/comparison.rs | 20 ++++++++++----------
 arrow/src/ipc/mod.rs                    |  1 +
 arrow/src/json/reader.rs                |  8 ++++----
 arrow/src/lib.rs                        |  6 ------
 7 files changed, 31 insertions(+), 36 deletions(-)

diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index f2157dd..23f6376 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -247,7 +247,7 @@ jobs:
         run: |
           export CARGO_HOME="/github/home/.cargo"
           export CARGO_TARGET_DIR="/github/home/target"
-          cargo clippy --features test_common --features prettyprint  --features=async --all-targets --workspace -- -D warnings -A clippy::redundant_field_names
+          cargo clippy --features test_common --features prettyprint  --features=async --all-targets --workspace -- -D warnings
 
   check_benches:
     name: Check Benchmarks (but don't run them)
diff --git a/arrow/src/buffer/ops.rs b/arrow/src/buffer/ops.rs
index 279c85e..e0086a1 100644
--- a/arrow/src/buffer/ops.rs
+++ b/arrow/src/buffer/ops.rs
@@ -34,18 +34,18 @@ use super::{Buffer, MutableBuffer};
 /// Contrary to the non-simd version `bitwise_bin_op_helper`, the offset and length is specified in bytes
 /// and this version does not support operations starting at arbitrary bit offsets.
 #[cfg(feature = "simd")]
-pub fn bitwise_bin_op_simd_helper<F_SIMD, F_SCALAR>(
+pub fn bitwise_bin_op_simd_helper<SI, SC>(
     left: &Buffer,
     left_offset: usize,
     right: &Buffer,
     right_offset: usize,
     len: usize,
-    simd_op: F_SIMD,
-    scalar_op: F_SCALAR,
+    simd_op: SI,
+    scalar_op: SC,
 ) -> Buffer
 where
-    F_SIMD: Fn(u8x64, u8x64) -> u8x64,
-    F_SCALAR: Fn(u8, u8) -> u8,
+    SI: Fn(u8x64, u8x64) -> u8x64,
+    SC: Fn(u8, u8) -> u8,
 {
     let mut result = MutableBuffer::new(len).with_bitset(len, false);
     let lanes = u8x64::lanes();
@@ -83,16 +83,16 @@ where
 /// Contrary to the non-simd version `bitwise_unary_op_helper`, the offset and length is specified in bytes
 /// and this version does not support operations starting at arbitrary bit offsets.
 #[cfg(feature = "simd")]
-pub fn bitwise_unary_op_simd_helper<F_SIMD, F_SCALAR>(
+pub fn bitwise_unary_op_simd_helper<SI, SC>(
     left: &Buffer,
     left_offset: usize,
     len: usize,
-    simd_op: F_SIMD,
-    scalar_op: F_SCALAR,
+    simd_op: SI,
+    scalar_op: SC,
 ) -> Buffer
 where
-    F_SIMD: Fn(u8x64) -> u8x64,
-    F_SCALAR: Fn(u8) -> u8,
+    SI: Fn(u8x64) -> u8x64,
+    SC: Fn(u8) -> u8,
 {
     let mut result = MutableBuffer::new(len).with_bitset(len, false);
     let lanes = u8x64::lanes();
diff --git a/arrow/src/compute/kernels/arithmetic.rs b/arrow/src/compute/kernels/arithmetic.rs
index 04a7e2f..2d63924 100644
--- a/arrow/src/compute/kernels/arithmetic.rs
+++ b/arrow/src/compute/kernels/arithmetic.rs
@@ -296,17 +296,17 @@ where
 /// * the arrays have different lengths
 /// * there is an element where both left and right values are valid and the right value is `0`
 #[cfg(feature = "simd")]
-fn simd_checked_divide_op<T, SIMD_OP, SCALAR_OP>(
+fn simd_checked_divide_op<T, SI, SC>(
     left: &PrimitiveArray<T>,
     right: &PrimitiveArray<T>,
-    simd_op: SIMD_OP,
-    scalar_op: SCALAR_OP,
+    simd_op: SI,
+    scalar_op: SC,
 ) -> Result<PrimitiveArray<T>>
 where
     T: ArrowNumericType,
     T::Native: One + Zero,
-    SIMD_OP: Fn(Option<u64>, T::Simd, T::Simd) -> Result<T::Simd>,
-    SCALAR_OP: Fn(T::Native, T::Native) -> T::Native,
+    SI: Fn(Option<u64>, T::Simd, T::Simd) -> Result<T::Simd>,
+    SC: Fn(T::Native, T::Native) -> T::Native,
 {
     if left.len() != right.len() {
         return Err(ArrowError::ComputeError(
diff --git a/arrow/src/compute/kernels/comparison.rs b/arrow/src/compute/kernels/comparison.rs
index 34a90f1..2aec3ee 100644
--- a/arrow/src/compute/kernels/comparison.rs
+++ b/arrow/src/compute/kernels/comparison.rs
@@ -1655,16 +1655,16 @@ where
 /// Helper function to perform boolean lambda function on values from two arrays using
 /// SIMD.
 #[cfg(feature = "simd")]
-fn simd_compare_op<T, SIMD_OP, SCALAR_OP>(
+fn simd_compare_op<T, SI, SC>(
     left: &PrimitiveArray<T>,
     right: &PrimitiveArray<T>,
-    simd_op: SIMD_OP,
-    scalar_op: SCALAR_OP,
+    simd_op: SI,
+    scalar_op: SC,
 ) -> Result<BooleanArray>
 where
     T: ArrowNumericType,
-    SIMD_OP: Fn(T::Simd, T::Simd) -> T::SimdMask,
-    SCALAR_OP: Fn(T::Native, T::Native) -> bool,
+    SI: Fn(T::Simd, T::Simd) -> T::SimdMask,
+    SC: Fn(T::Native, T::Native) -> bool,
 {
     use std::borrow::BorrowMut;
 
@@ -1755,16 +1755,16 @@ where
 /// Helper function to perform boolean lambda function on values from an array and a scalar value using
 /// SIMD.
 #[cfg(feature = "simd")]
-fn simd_compare_op_scalar<T, SIMD_OP, SCALAR_OP>(
+fn simd_compare_op_scalar<T, SI, SC>(
     left: &PrimitiveArray<T>,
     right: T::Native,
-    simd_op: SIMD_OP,
-    scalar_op: SCALAR_OP,
+    simd_op: SI,
+    scalar_op: SC,
 ) -> Result<BooleanArray>
 where
     T: ArrowNumericType,
-    SIMD_OP: Fn(T::Simd, T::Simd) -> T::SimdMask,
-    SCALAR_OP: Fn(T::Native, T::Native) -> bool,
+    SI: Fn(T::Simd, T::Simd) -> T::SimdMask,
+    SC: Fn(T::Native, T::Native) -> bool,
 {
     use std::borrow::BorrowMut;
 
diff --git a/arrow/src/ipc/mod.rs b/arrow/src/ipc/mod.rs
index a2d7103..d5455b4 100644
--- a/arrow/src/ipc/mod.rs
+++ b/arrow/src/ipc/mod.rs
@@ -27,6 +27,7 @@ pub mod writer;
 #[allow(clippy::extra_unused_lifetimes)]
 #[allow(clippy::redundant_static_lifetimes)]
 #[allow(clippy::redundant_field_names)]
+#[allow(non_camel_case_types)]
 pub mod gen;
 
 pub use self::gen::File::*;
diff --git a/arrow/src/json/reader.rs b/arrow/src/json/reader.rs
index a8fe7a1..ffae2a9 100644
--- a/arrow/src/json/reader.rs
+++ b/arrow/src/json/reader.rs
@@ -735,14 +735,14 @@ impl Decoder {
     }
 
     #[inline(always)]
-    fn list_array_string_array_builder<DICT_TY>(
+    fn list_array_string_array_builder<DT>(
         &self,
         data_type: &DataType,
         col_name: &str,
         rows: &[Value],
     ) -> Result<ArrayRef>
     where
-        DICT_TY: ArrowPrimitiveType + ArrowDictionaryKeyType,
+        DT: ArrowPrimitiveType + ArrowDictionaryKeyType,
     {
         let mut builder: Box<dyn ArrayBuilder> = match data_type {
             DataType::Utf8 => {
@@ -751,7 +751,7 @@ impl Decoder {
             }
             DataType::Dictionary(_, _) => {
                 let values_builder =
-                    self.build_string_dictionary_builder::<DICT_TY>(rows.len() * 5)?;
+                    self.build_string_dictionary_builder::<DT>(rows.len() * 5)?;
                 Box::new(ListBuilder::new(values_builder))
             }
             e => {
@@ -813,7 +813,7 @@ impl Decoder {
                         builder.append(true)?;
                     }
                     DataType::Dictionary(_, _) => {
-                        let builder = builder.as_any_mut().downcast_mut::<ListBuilder<StringDictionaryBuilder<DICT_TY>>>().ok_or_else(||ArrowError::JsonError(
+                        let builder = builder.as_any_mut().downcast_mut::<ListBuilder<StringDictionaryBuilder<DT>>>().ok_or_else(||ArrowError::JsonError(
                             "Cast failed for ListBuilder<StringDictionaryBuilder> during nested data parsing".to_string(),
                         ))?;
                         for val in vals {
diff --git a/arrow/src/lib.rs b/arrow/src/lib.rs
index 2c1a95e..6c09c20 100644
--- a/arrow/src/lib.rs
+++ b/arrow/src/lib.rs
@@ -128,13 +128,7 @@
 #![cfg_attr(feature = "avx512", feature(repr_simd))]
 #![cfg_attr(feature = "avx512", feature(avx512_target_feature))]
 #![allow(dead_code)]
-#![allow(non_camel_case_types)]
 #![deny(clippy::redundant_clone)]
-#![allow(
-    // upper_case_acronyms lint was introduced in Rust 1.51.
-    // It is triggered in the ffi module, and ipc::gen, which we have no control over
-    clippy::upper_case_acronyms,
-)]
 #![warn(missing_debug_implementations)]
 
 pub mod alloc;