Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
chore: Make rust clippy happy
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Jul 1, 2022
1 parent c52b3e7 commit 0803770
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 25 deletions.
1 change: 1 addition & 0 deletions examples/ipc_file_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use arrow2::io::ipc::read;
use arrow2::io::print;

/// Simplest way: read all record batches from the file. This can be used e.g. for random access.
#[allow(clippy::type_complexity)]
fn read_batches(path: &str) -> Result<(Schema, Vec<Chunk<Box<dyn Array>>>)> {
let mut file = File::open(path)?;

Expand Down
12 changes: 6 additions & 6 deletions src/bitmap/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ fn or_assign<T: BitChunk>(lhs: &mut MutableBitmap, rhs: &Bitmap) {
}
}

impl<'a, 'b> std::ops::BitOrAssign<&'a Bitmap> for &'b mut MutableBitmap {
impl<'a> std::ops::BitOrAssign<&'a Bitmap> for &mut MutableBitmap {
#[inline]
fn bitor_assign(&mut self, rhs: &'a Bitmap) {
or_assign::<u64>(self, rhs)
}
}

impl<'a, 'b> std::ops::BitOr<&'a Bitmap> for MutableBitmap {
impl<'a> std::ops::BitOr<&'a Bitmap> for MutableBitmap {
type Output = Self;

#[inline]
Expand All @@ -150,14 +150,14 @@ fn and_assign<T: BitChunk>(lhs: &mut MutableBitmap, rhs: &Bitmap) {
}
}

impl<'a, 'b> std::ops::BitAndAssign<&'a Bitmap> for &'b mut MutableBitmap {
impl<'a> std::ops::BitAndAssign<&'a Bitmap> for &mut MutableBitmap {
#[inline]
fn bitand_assign(&mut self, rhs: &'a Bitmap) {
and_assign::<u64>(self, rhs)
}
}

impl<'a, 'b> std::ops::BitAnd<&'a Bitmap> for MutableBitmap {
impl<'a> std::ops::BitAnd<&'a Bitmap> for MutableBitmap {
type Output = Self;

#[inline]
Expand All @@ -173,14 +173,14 @@ fn xor_assign<T: BitChunk>(lhs: &mut MutableBitmap, rhs: &Bitmap) {
binary_assign(lhs, rhs, |x: T, y| x ^ y)
}

impl<'a, 'b> std::ops::BitXorAssign<&'a Bitmap> for &'b mut MutableBitmap {
impl<'a> std::ops::BitXorAssign<&'a Bitmap> for &mut MutableBitmap {
#[inline]
fn bitxor_assign(&mut self, rhs: &'a Bitmap) {
xor_assign::<u64>(self, rhs)
}
}

impl<'a, 'b> std::ops::BitXor<&'a Bitmap> for MutableBitmap {
impl<'a> std::ops::BitXor<&'a Bitmap> for MutableBitmap {
type Output = Self;

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::error::{Error, Result};

/// A vector of trait objects of [`Array`] where every item has
/// the same length, [`Chunk::len`].
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Chunk<A: AsRef<dyn Array>> {
arrays: Vec<A>,
}
Expand Down
4 changes: 2 additions & 2 deletions src/io/avro/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ macro_rules! read_metadata {
pub(crate) use {avro_decode, read_header, read_metadata};

/// A compressed Avro block.
#[derive(Debug, Clone, Default, PartialEq)]
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct CompressedBlock {
/// The number of rows
pub number_of_rows: usize,
Expand All @@ -112,7 +112,7 @@ impl CompressedBlock {
}

/// An uncompressed Avro block.
#[derive(Debug, Clone, Default, PartialEq)]
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct Block {
/// The number of rows
pub number_of_rows: usize,
Expand Down
2 changes: 1 addition & 1 deletion src/io/avro/read/decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<R: Read> Decompressor<R> {
}
}

impl<'a, R: Read> FallibleStreamingIterator for Decompressor<R> {
impl<R: Read> FallibleStreamingIterator for Decompressor<R> {
type Error = Error;
type Item = Block;

Expand Down
2 changes: 1 addition & 1 deletion src/io/parquet/read/deserialize/nested_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ where
}
}

#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InitNested {
Primitive(bool),
List(bool),
Expand Down
2 changes: 1 addition & 1 deletion src/io/parquet/read/deserialize/primitive/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
op: F,
}

impl<'a, T, P, F> PrimitiveDecoder<T, P, F>
impl<T, P, F> PrimitiveDecoder<T, P, F>
where
T: NativeType,
P: ParquetNativeType,
Expand Down
2 changes: 1 addition & 1 deletion src/io/parquet/read/deserialize/primitive/nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ where
op: F,
}

impl<'a, T, P, F> PrimitiveDecoder<T, P, F>
impl<T, P, F> PrimitiveDecoder<T, P, F>
where
T: NativeType,
P: ParquetNativeType,
Expand Down
12 changes: 5 additions & 7 deletions src/io/parquet/read/statistics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,10 @@ fn push(
// some implementations of parquet write arrow's u32 into i64.
ParquetPhysicalType::Int64 => primitive::push(from, min, max, |x: i64| Ok(x as u32)),
ParquetPhysicalType::Int32 => primitive::push(from, min, max, |x: i32| Ok(x as u32)),
other => {
return Err(Error::NotYetImplemented(format!(
"Can't decode UInt32 type from parquet type {:?}",
other
)))
}
other => Err(Error::NotYetImplemented(format!(
"Can't decode UInt32 type from parquet type {:?}",
other
))),
},
Int32 => primitive::push(from, min, max, |x: i32| Ok(x as i32)),
Int64 | Date64 | Time64(_) | Duration(_) => {
Expand All @@ -442,7 +440,7 @@ fn push(
ParquetPhysicalType::Int32 => primitive::push(from, min, max, |x: i32| Ok(x as i128)),
ParquetPhysicalType::Int64 => primitive::push(from, min, max, |x: i64| Ok(x as i128)),
ParquetPhysicalType::FixedLenByteArray(n) if *n > 16 => {
return Err(Error::NotYetImplemented(format!(
Err(Error::NotYetImplemented(format!(
"Can't decode Decimal128 type from Fixed Size Byte Array of len {:?}",
n
)))
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#![allow(clippy::len_without_is_empty)]
// Trait objects must be returned as a &Box<dyn Array> so that they can be cloned
#![allow(clippy::borrowed_box)]
// Allow type complexity warning to avoid API break.
#![allow(clippy::type_complexity)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(feature = "simd", feature(portable_simd))]

Expand Down
2 changes: 1 addition & 1 deletion src/scalar/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{array::*, datatypes::DataType};
use super::Scalar;

/// The [`Scalar`] implementation of binary ([`Option<Vec<u8>>`]).
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BinaryScalar<O: Offset> {
value: Option<Vec<u8>>,
phantom: std::marker::PhantomData<O>,
Expand Down
2 changes: 1 addition & 1 deletion src/scalar/boolean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::datatypes::DataType;
use super::Scalar;

/// The [`Scalar`] implementation of a boolean.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BooleanScalar {
value: Option<bool>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/scalar/fixed_size_binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::datatypes::DataType;

use super::Scalar;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
/// The [`Scalar`] implementation of fixed size binary ([`Option<Box<[u8]>>`]).
pub struct FixedSizeBinaryScalar {
value: Option<Box<[u8]>>,
Expand Down
2 changes: 1 addition & 1 deletion src/scalar/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::Scalar;

/// The implementation of [`Scalar`] for primitive, semantically equivalent to [`Option<T>`]
/// with [`DataType`].
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PrimitiveScalar<T: NativeType> {
value: Option<T>,
data_type: DataType,
Expand Down
2 changes: 1 addition & 1 deletion src/scalar/utf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{array::*, datatypes::DataType};
use super::Scalar;

/// The implementation of [`Scalar`] for utf8, semantically equivalent to [`Option<String>`].
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Utf8Scalar<O: Offset> {
value: Option<String>,
phantom: std::marker::PhantomData<O>,
Expand Down

0 comments on commit 0803770

Please sign in to comment.