Skip to content

Commit

Permalink
Enable more lints (#1315)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsserge authored Feb 16, 2022
1 parent 630b381 commit c26a0a1
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions arrow/src/buffer/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 5 additions & 5 deletions arrow/src/compute/kernels/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
20 changes: 10 additions & 10 deletions arrow/src/compute/kernels/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions arrow/src/ipc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
8 changes: 4 additions & 4 deletions arrow/src/json/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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 => {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions arrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c26a0a1

Please sign in to comment.