Skip to content

Commit

Permalink
clippy/fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
orlp committed Sep 26, 2023
1 parent 3c1b909 commit 5eb2e9c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 19 deletions.
11 changes: 1 addition & 10 deletions crates/nano-arrow/src/bitmap/bitmask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ fn load_padded_le_u64(bytes: &[u8]) -> u64 {
lo | mid | hi
}

#[derive(Default, Clone)]
pub struct BitMask<'a> {
bytes: &'a [u8],
offset: usize,
Expand Down Expand Up @@ -232,16 +233,6 @@ impl<'a> BitMask<'a> {
}
}

impl<'a> Default for BitMask<'a> {
fn default() -> Self {
Self {
bytes: &[],
offset: 0,
len: 0,
}
}
}

#[cfg(test)]
mod test {
use super::*;
Expand Down
1 change: 0 additions & 1 deletion crates/nano-arrow/src/compute/concatenate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pub fn concatenate(arrays: &[&dyn Array]) -> Result<Box<dyn Array>> {
Ok(mutable.as_box())
}


/// Concatenate the validities of multiple [Array]s into a single Bitmap.
pub fn concatenate_validities(arrays: &[&dyn Array]) -> Option<Bitmap> {
let null_count: usize = arrays.iter().map(|a| a.null_count()).sum();
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-core/src/datatypes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub unsafe trait PolarsDataType: Send + Sync + Sized {
type ZeroablePhysical<'a>: Zeroable + From<Self::Physical<'a>>;
type Array: for<'a> StaticArray<
ValueT<'a> = Self::Physical<'a>,
ZeroableValueT<'a> = Self::ZeroablePhysical<'a>
ZeroableValueT<'a> = Self::ZeroablePhysical<'a>,
>;

fn get_dtype() -> DataType
Expand Down
12 changes: 6 additions & 6 deletions crates/polars-core/src/datatypes/static_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub trait StaticArray:
fn iter(&self) -> ZipValidity<Self::ValueT<'_>, Self::ValueIterT<'_>, BitmapIter>;
fn values_iter(&self) -> Self::ValueIterT<'_>;
fn with_validity_typed(self, validity: Option<Bitmap>) -> Self;

fn from_vec(v: Vec<Self::ValueT<'_>>, dtype: DataType) -> Self {
v.into_iter().collect_arr_with_dtype(dtype)
}
Expand Down Expand Up @@ -108,7 +108,7 @@ impl<T: NumericNative> StaticArray for PrimitiveArray<T> {
fn with_validity_typed(self, validity: Option<Bitmap>) -> Self {
self.with_validity(validity)
}

fn from_vec(v: Vec<Self::ValueT<'_>>, _dtype: DataType) -> Self {
PrimitiveArray::from_vec(v)
}
Expand Down Expand Up @@ -145,13 +145,13 @@ impl StaticArray for BooleanArray {
fn with_validity_typed(self, validity: Option<Bitmap>) -> Self {
self.with_validity(validity)
}

fn from_vec(v: Vec<Self::ValueT<'_>>, _dtype: DataType) -> Self {
BooleanArray::from_slice(&v)
BooleanArray::from_slice(v)
}

fn from_zeroable_vec(v: Vec<Self::ValueT<'_>>, _dtype: DataType) -> Self {
BooleanArray::from_slice(&v)
BooleanArray::from_slice(v)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/polars-ops/src/chunked_array/gather_skip_nulls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ unsafe fn gather_skip_null_idx_pairs_unchecked<'a, T: PolarsDataType>(
mut index_pairs: Vec<(IdxSize, IdxSize)>,
len: usize,
) -> Vec<T::ZeroablePhysical<'a>> {
if index_pairs.len() == 0 {
if index_pairs.is_empty() {
return zeroed_vec(len);
}

Expand Down

0 comments on commit 5eb2e9c

Please sign in to comment.