Skip to content

Commit 81a7e19

Browse files
joseph-isaacsa10y
authored andcommitted
chore[*]: prefer #[expect(..)] over #[allow(..)] (#5498)
We cannot fully remove allow --------- Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent cb52c89 commit 81a7e19

File tree

38 files changed

+156
-54
lines changed

38 files changed

+156
-54
lines changed

encodings/alp/src/alp/compress.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ pub fn decompress(array: ALPArray) -> PrimitiveArray {
161161
/// # Returns
162162
///
163163
/// A `PrimitiveArray` containing the decompressed values with all patches applied.
164-
#[allow(clippy::cognitive_complexity)]
164+
#[expect(
165+
clippy::cognitive_complexity,
166+
reason = "complexity is from nested match_each_* macros"
167+
)]
165168
pub fn decompress_chunked(
166169
array: ALPArray,
167170
patches: &Patches,

encodings/alp/src/alp/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ pub trait ALPFloat: private::Sealed + Float + Display + NativePType {
154154
encoded_bytes + patch_bytes
155155
}
156156

157-
#[allow(clippy::type_complexity)]
157+
#[expect(
158+
clippy::type_complexity,
159+
reason = "tuple return type is appropriate for multiple encoding outputs"
160+
)]
158161
fn encode(
159162
values: &[Self],
160163
exponents: Option<Exponents>,

encodings/fastlanes/src/rle/array/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ impl RLEArray {
127127
/// - The `indices` array contains valid indices into chunks of the `values` array
128128
/// - The `values_idx_offsets` array contains valid chunk start offsets
129129
/// - The `validity` array has the same length as `length`
130-
#[allow(clippy::too_many_arguments)]
131130
pub unsafe fn new_unchecked(
132131
values: ArrayRef,
133132
indices: ArrayRef,
@@ -182,7 +181,10 @@ impl RLEArray {
182181
/// Offsets in `values_idx_offsets` are absolute and need to be shifted
183182
/// by the offset of the first chunk, respective the current slice, in
184183
/// order to make them relative.
185-
#[allow(clippy::expect_used)]
184+
#[expect(
185+
clippy::expect_used,
186+
reason = "expect is safe here as scalar_at returns a valid primitive"
187+
)]
186188
pub(crate) fn values_idx_offset(&self, chunk_idx: usize) -> usize {
187189
self.values_idx_offsets
188190
.scalar_at(chunk_idx)

encodings/fastlanes/src/rle/array/rle_decompress.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ use crate::FL_CHUNK_SIZE;
1919
use crate::RLEArray;
2020

2121
/// Decompresses an RLE array back into a primitive array.
22-
#[allow(clippy::cognitive_complexity)]
22+
#[expect(
23+
clippy::cognitive_complexity,
24+
reason = "complexity is from nested match_each_* macros"
25+
)]
2326
pub fn rle_decompress(array: &RLEArray) -> PrimitiveArray {
2427
match_each_native_ptype!(array.values().dtype().as_ptype(), |V| {
2528
match_each_unsigned_integer_ptype!(array.values_idx_offsets().dtype().as_ptype(), |O| {
@@ -37,7 +40,6 @@ pub fn rle_decompress(array: &RLEArray) -> PrimitiveArray {
3740
}
3841

3942
/// Decompresses an `RLEArray` into to a primitive array of unsigned integers.
40-
#[allow(clippy::cognitive_complexity)]
4143
fn rle_decode_typed<V, I, O>(array: &RLEArray) -> PrimitiveArray
4244
where
4345
V: NativePType + RLE + Clone + Copy,

encodings/fsst/src/canonical.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ impl CanonicalVTable<FSSTVTable> for FSSTVTable {
5050
}
5151
}
5252

53-
#[allow(clippy::cast_possible_truncation)]
53+
#[expect(
54+
clippy::cast_possible_truncation,
55+
reason = "truncation is intentional for buffer index"
56+
)]
5457
fn fsst_decode_views(fsst_array: &FSSTArray, buf_index: u32) -> (ByteBuffer, Buffer<BinaryView>) {
5558
// FSSTArray has two child arrays:
5659
// 1. A VarBinArray, which holds the string heap of the compressed codes.

encodings/sparse/src/canonical.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ impl CanonicalVTable<SparseVTable> for SparseVTable {
115115
}
116116
}
117117

118-
#[allow(clippy::cognitive_complexity)]
118+
#[expect(
119+
clippy::cognitive_complexity,
120+
reason = "complexity is from nested match_smallest_offset_type macro"
121+
)]
119122
fn canonicalize_sparse_lists(
120123
array: &SparseArray,
121124
values_dtype: Arc<DType>,

vortex-array/src/arrays/primitive/array/conversion.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ impl PrimitiveArray {
110110
}
111111

112112
/// Try to extract a mutable buffer from the PrimitiveArray with zero copy.
113-
#[allow(clippy::panic_in_result_fn)]
114113
pub fn try_into_buffer_mut<T: NativePType>(self) -> Result<BufferMut<T>, PrimitiveArray> {
115114
if T::PTYPE != self.ptype() {
116115
vortex_panic!(

vortex-array/src/arrays/primitive/array/patch.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use crate::validity::Validity;
1414
use crate::vtable::ValidityHelper;
1515

1616
impl PrimitiveArray {
17-
#[allow(clippy::cognitive_complexity)]
1817
pub fn patch(self, patches: &Patches) -> Self {
1918
let patch_indices = patches.indices().to_primitive();
2019
let patch_values = patches.values().to_primitive();
@@ -72,7 +71,10 @@ impl PrimitiveArray {
7271
/// * `base_offset` - Base offset from the first chunk
7372
/// * `offset_within_chunk` - Offset within chunk for sliced patches
7473
#[inline]
75-
#[allow(clippy::too_many_arguments)]
74+
#[expect(
75+
clippy::too_many_arguments,
76+
reason = "all arguments are needed for the patching operation"
77+
)]
7678
pub fn patch_chunk<T, I, C>(
7779
decoded_values: &mut [T],
7880
patches_indices: &[I],

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,6 @@ impl StructArray {
381381
/// which specifies the new ordering of columns in the struct. The projection can be used to
382382
/// perform column re-ordering, deletion, or duplication at a logical level, without any data
383383
/// copying.
384-
#[allow(clippy::same_name_method)]
385384
pub fn project(&self, projection: &[FieldName]) -> VortexResult<Self> {
386385
let mut children = Vec::with_capacity(projection.len());
387386
let mut names = Vec::with_capacity(projection.len());

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ impl VarBinArray {
243243
builder.finish(dtype)
244244
}
245245

246-
#[allow(clippy::same_name_method)]
246+
#[expect(
247+
clippy::same_name_method,
248+
reason = "intentionally named from_iter like Iterator::from_iter"
249+
)]
247250
pub fn from_iter<T: AsRef<[u8]>, I: IntoIterator<Item = Option<T>>>(
248251
iter: I,
249252
dtype: DType,

0 commit comments

Comments
 (0)