Skip to content

Commit 8bcfb52

Browse files
committed
wip
Signed-off-by: Joe Isaacs <[email protected]>
1 parent e4a9b38 commit 8bcfb52

File tree

12 files changed

+60
-16
lines changed

12 files changed

+60
-16
lines changed

encodings/alp/src/alp/compress.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ pub fn alp_encode(parray: &PrimitiveArray, exponents: Option<Exponents>) -> Vort
6363
}
6464
}
6565

66-
#[allow(clippy::cast_possible_truncation)]
66+
#[expect(
67+
clippy::cast_possible_truncation,
68+
reason = "u64 index cast to usize is safe for reasonable array sizes"
69+
)]
6770
fn alp_encode_components_typed<T>(
6871
values: &PrimitiveArray,
6972
exponents: Option<Exponents>,

encodings/alp/src/alp/mod.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,10 @@ pub trait ALPFloat: private::Sealed + Float + Display + NativePType {
268268
}
269269
}
270270

271-
#[allow(clippy::cast_possible_truncation)]
271+
#[expect(
272+
clippy::cast_possible_truncation,
273+
reason = "intentional truncation for ALP encoding"
274+
)]
272275
fn encode_chunk_unchecked<T: ALPFloat>(
273276
chunk: &[T],
274277
exp: Exponents,
@@ -376,7 +379,10 @@ impl ALPFloat for f32 {
376379
];
377380

378381
#[inline(always)]
379-
#[allow(clippy::cast_possible_truncation)]
382+
#[expect(
383+
clippy::cast_possible_truncation,
384+
reason = "intentional float to int truncation for ALP encoding"
385+
)]
380386
fn as_int(self) -> Self::ALPInt {
381387
self as _
382388
}
@@ -448,7 +454,10 @@ impl ALPFloat for f64 {
448454
];
449455

450456
#[inline(always)]
451-
#[allow(clippy::cast_possible_truncation)]
457+
#[expect(
458+
clippy::cast_possible_truncation,
459+
reason = "intentional float to int truncation for ALP encoding"
460+
)]
452461
fn as_int(self) -> Self::ALPInt {
453462
self as _
454463
}

encodings/fastlanes/src/bitpacking/array/bitpack_compress.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ pub fn find_best_bit_width(ptype: PType, bit_width_freq: &[usize]) -> VortexResu
332332

333333
/// Assuming exceptions cost 1 value + 1 u32 index, figure out the best bit-width to use.
334334
/// We could try to be clever, but we can never really predict how the exceptions will compress.
335-
#[allow(clippy::cast_possible_truncation)]
335+
#[expect(
336+
clippy::cast_possible_truncation,
337+
reason = "bit_width is bounded by check above and result fits in u8"
338+
)]
336339
fn best_bit_width(bit_width_freq: &[usize], bytes_per_exception: usize) -> VortexResult<u8> {
337340
if bit_width_freq.len() > u8::MAX as usize {
338341
vortex_bail!("Too many bit widths");

encodings/fastlanes/src/for/array/for_compress.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ impl FoRArray {
2727
}
2828
}
2929

30-
#[allow(clippy::cast_possible_truncation)]
30+
#[expect(
31+
clippy::cast_possible_truncation,
32+
reason = "generic type T handles appropriate widths"
33+
)]
3134
fn compress_primitive<T: NativePType + WrappingSub + PrimInt>(
3235
parray: PrimitiveArray,
3336
min: T,

encodings/runend/src/compute/take.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ use crate::RunEndArray;
2525
use crate::RunEndVTable;
2626

2727
impl TakeKernel for RunEndVTable {
28-
#[allow(clippy::cast_possible_truncation)]
28+
#[expect(
29+
clippy::cast_possible_truncation,
30+
reason = "index cast to usize inside macro"
31+
)]
2932
fn take(&self, array: &RunEndArray, indices: &dyn Array) -> VortexResult<ArrayRef> {
3033
let primitive_indices = indices.to_primitive();
3134

vortex-array/src/arrays/decimal/array.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ impl DecimalArray {
253253
)
254254
}
255255

256-
#[allow(clippy::cognitive_complexity)]
256+
#[expect(
257+
clippy::cognitive_complexity,
258+
reason = "complexity from nested match_each_* macros"
259+
)]
257260
pub fn patch(self, patches: &Patches) -> Self {
258261
let offset = patches.offset();
259262
let patch_indices = patches.indices().to_primitive();

vortex-array/src/arrays/decimal/compute/sum.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ macro_rules! sum_decimal {
4949
}
5050

5151
impl SumKernel for DecimalVTable {
52-
#[allow(clippy::cognitive_complexity)]
52+
#[expect(
53+
clippy::cognitive_complexity,
54+
reason = "complexity from nested match_each_* macros"
55+
)]
5356
fn sum(&self, array: &DecimalArray, accumulator: &Scalar) -> VortexResult<Scalar> {
5457
let decimal_dtype = array.decimal_dtype();
5558

vortex-array/src/arrays/primitive/compute/take/avx2.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ use crate::validity::Validity;
5151
pub(super) struct TakeKernelAVX2;
5252

5353
impl TakeImpl for TakeKernelAVX2 {
54-
#[allow(clippy::cognitive_complexity)]
54+
#[expect(
55+
clippy::cognitive_complexity,
56+
reason = "complexity from nested match_each_* macros"
57+
)]
5558
#[inline(always)]
5659
fn take(
5760
&self,

vortex-array/src/arrow/compute/to_arrow/canonical.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ use crate::compute::cast;
8787
pub(super) struct ToArrowCanonical;
8888

8989
impl Kernel for ToArrowCanonical {
90-
#[allow(clippy::cognitive_complexity)]
90+
#[expect(
91+
clippy::cognitive_complexity,
92+
reason = "large match statement for all canonical types"
93+
)]
9194
fn invoke(&self, args: &InvocationArgs) -> VortexResult<Option<Output>> {
9295
let ToArrowArgs {
9396
array,

vortex-btrblocks/src/integer.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,10 @@ impl Scheme for BitPackingScheme {
397397
BITPACKING_SCHEME
398398
}
399399

400-
#[allow(clippy::cast_possible_truncation)]
400+
#[expect(
401+
clippy::cast_possible_truncation,
402+
reason = "bit width fits in smaller integer types"
403+
)]
401404
fn expected_compression_ratio(
402405
&self,
403406
stats: &IntegerStats,
@@ -424,7 +427,10 @@ impl Scheme for BitPackingScheme {
424427
)
425428
}
426429

427-
#[allow(clippy::cast_possible_truncation)]
430+
#[expect(
431+
clippy::cast_possible_truncation,
432+
reason = "bit width fits in smaller integer types"
433+
)]
428434
fn compress(
429435
&self,
430436
stats: &IntegerStats,

0 commit comments

Comments
 (0)