Skip to content

Commit 984b64f

Browse files
chore[*]: prefer #[expect(..)] over #[allow(..)] p2 (#5533)
Signed-off-by: Joe Isaacs <[email protected]>
1 parent fe4c81b commit 984b64f

File tree

27 files changed

+83
-35
lines changed

27 files changed

+83
-35
lines changed

bench-vortex/src/benchmark_driver.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ pub fn run_benchmark<B: Benchmark>(benchmark: B, config: DriverConfig) -> Result
152152
)
153153
}
154154

155-
#[allow(clippy::too_many_arguments)]
155+
#[expect(
156+
clippy::too_many_arguments,
157+
reason = "all arguments needed for benchmark execution"
158+
)]
156159
fn execute_queries<B: Benchmark>(
157160
queries: &[(usize, String)],
158161
iterations: usize,

bench-vortex/src/statpopgen/builder.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ impl<'a> GnomADBuilder<'a> {
264264
}
265265
}
266266

267-
#[allow(clippy::cognitive_complexity)]
268267
pub fn consume_record(&mut self, header: &Header, record: &mut Record) -> VortexResult<()> {
269268
self.CHROM_builder
270269
.append_value(record.reference_sequence_name());
@@ -352,7 +351,6 @@ impl<'a> GnomADBuilder<'a> {
352351
Ok(())
353352
}
354353

355-
#[allow(clippy::cognitive_complexity)]
356354
pub fn consume_info(&mut self, header: &Header, info: Info) -> VortexResult<()> {
357355
info.iter(header)
358356
.process_results(|iter| -> VortexResult<()> {
@@ -376,7 +374,6 @@ impl<'a> GnomADBuilder<'a> {
376374
})?
377375
}
378376

379-
#[allow(clippy::cognitive_complexity)]
380377
pub fn finish(mut self) -> Result<RecordBatch, ArrowError> {
381378
let len = self.CHROM_builder.len();
382379
assert_eq!(len, self.POS_builder.len());

bench-vortex/src/tpch/dbgen.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ impl DBGen {
7474
}
7575

7676
impl DBGen {
77-
#[allow(clippy::unwrap_in_result)]
77+
#[expect(
78+
clippy::unwrap_in_result,
79+
reason = "benchmark code where unwrap is acceptable"
80+
)]
7881
/// Generate the TPC-H data files for use with benchmarks.
7982
pub fn generate(&self) -> anyhow::Result<PathBuf> {
8083
let sh = Shell::new()?;

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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ impl FoRArray {
2727
}
2828
}
2929

30-
#[allow(clippy::cast_possible_truncation)]
3130
fn compress_primitive<T: NativePType + WrappingSub + PrimInt>(
3231
parray: PrimitiveArray,
3332
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

encodings/sparse/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,6 @@ impl ValidityVTable<SparseVTable> for SparseVTable {
386386
array.patches().values().all_invalid()
387387
}
388388

389-
#[allow(clippy::unnecessary_fallible_conversions)]
390389
fn validity_mask(array: &SparseArray) -> Mask {
391390
let fill_is_valid = array.fill_scalar().is_valid();
392391
let values_validity = array.patches().values().validity_mask();

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();

0 commit comments

Comments
 (0)