Skip to content

Commit d2d79f0

Browse files
skip[clippy]: add some more hints (#7713)
requires these clippy lints: ```toml redundant_static_lifetimes = "deny" ref_binding_to_reference = "deny" ref_patterns = "deny" repeat_vec_with_capacity = "deny" reserve_after_initialization = "deny" ``` --------- Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 140eec6 commit d2d79f0

18 files changed

Lines changed: 44 additions & 39 deletions

File tree

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@ panic = "deny"
352352
# panic_in_result_fn = "deny" -- we cannot disable this for tests to use assertions
353353
clone_on_ref_ptr = "deny"
354354
redundant_clone = "deny"
355+
redundant_static_lifetimes = "deny"
356+
ref_binding_to_reference = "deny"
357+
ref_patterns = "deny"
358+
repeat_vec_with_capacity = "deny"
359+
reserve_after_initialization = "deny"
355360
same_name_method = "deny"
356361
tests_outside_test_module = "deny"
357362
# todo = "deny"

encodings/alp/src/alp/decompress.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ pub fn decompress_into_array(
3131
) -> VortexResult<PrimitiveArray> {
3232
let dtype = array.dtype().clone();
3333
let (encoded, exponents, patches) = ALPArrayOwnedExt::into_parts(array);
34-
if let Some(ref patches) = patches
35-
&& let Some(chunk_offsets) = patches.chunk_offsets()
34+
if let Some(p) = &patches
35+
&& let Some(chunk_offsets) = p.chunk_offsets()
3636
{
3737
let prim_encoded = encoded.execute::<PrimitiveArray>(ctx)?;
3838
let patches_chunk_offsets = chunk_offsets.clone().execute::<PrimitiveArray>(ctx)?;
39-
let patches_indices = patches.indices().clone().execute::<PrimitiveArray>(ctx)?;
40-
let patches_values = patches.values().clone().execute::<PrimitiveArray>(ctx)?;
39+
let patches_indices = p.indices().clone().execute::<PrimitiveArray>(ctx)?;
40+
let patches_values = p.values().clone().execute::<PrimitiveArray>(ctx)?;
4141
Ok(decompress_chunked_core(
4242
prim_encoded,
4343
exponents,
4444
&patches_indices,
4545
&patches_values,
4646
&patches_chunk_offsets,
47-
patches,
47+
p,
4848
dtype,
4949
))
5050
} else {
@@ -64,21 +64,21 @@ pub fn decompress_into_array(
6464
pub fn execute_decompress(array: ALPArray, ctx: &mut ExecutionCtx) -> VortexResult<PrimitiveArray> {
6565
let dtype = array.dtype().clone();
6666
let (encoded, exponents, patches) = ALPArrayOwnedExt::into_parts(array);
67-
if let Some(ref patches) = patches
68-
&& let Some(chunk_offsets) = patches.chunk_offsets()
67+
if let Some(p) = &patches
68+
&& let Some(chunk_offsets) = p.chunk_offsets()
6969
{
7070
// TODO(joe): have into parts.
7171
let encoded = encoded.execute::<PrimitiveArray>(ctx)?;
7272
let patches_chunk_offsets = chunk_offsets.clone().execute::<PrimitiveArray>(ctx)?;
73-
let patches_indices = patches.indices().clone().execute::<PrimitiveArray>(ctx)?;
74-
let patches_values = patches.values().clone().execute::<PrimitiveArray>(ctx)?;
73+
let patches_indices = p.indices().clone().execute::<PrimitiveArray>(ctx)?;
74+
let patches_values = p.values().clone().execute::<PrimitiveArray>(ctx)?;
7575
Ok(decompress_chunked_core(
7676
encoded,
7777
exponents,
7878
&patches_indices,
7979
&patches_values,
8080
&patches_chunk_offsets,
81-
patches,
81+
p,
8282
dtype,
8383
))
8484
} else {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pub(crate) fn unpack_into_primitive_builder<T: BitPackedUnpack>(
6767
let mut bit_packed_iter = array.unpacked_chunks()?;
6868
bit_packed_iter.decode_into(uninit_slice);
6969

70-
if let Some(ref patches) = array.patches() {
71-
apply_patches_to_uninit_range(&mut uninit_range, patches, ctx)?;
70+
if let Some(patches) = array.patches() {
71+
apply_patches_to_uninit_range(&mut uninit_range, &patches, ctx)?;
7272
};
7373

7474
// SAFETY: We have set a correct validity mask via `append_mask` with `array.len()` values and

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ pub(crate) fn fused_decompress<
118118
// Decode all chunks (initial, full, and trailer) in one call.
119119
unpacked.decode_into(uninit_slice);
120120

121-
if let Some(ref patches) = bp.patches() {
121+
if let Some(patches) = bp.patches() {
122122
bitpack_decompress::apply_patches_to_uninit_range_fn(
123123
&mut uninit_range,
124-
patches,
124+
&patches,
125125
ctx,
126126
|v| v.wrapping_add(&ref_),
127127
)?;

vortex-array/src/aggregate_fn/fns/is_sorted/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ impl AggregateFnVTable for IsSorted {
304304
}
305305

306306
// Check boundary: self.last_value vs other.first_value
307-
if let Some(ref self_last) = partial.last_value
308-
&& let Some(ref other_first_val) = other_first
307+
if let Some(self_last) = &partial.last_value
308+
&& let Some(other_first_val) = &other_first
309309
{
310310
if !self_last.is_null() && !other_first_val.is_null() {
311311
let boundary_ok = if partial.strict {
@@ -404,7 +404,7 @@ impl AggregateFnVTable for IsSorted {
404404
}
405405

406406
// Check boundary with previous chunk.
407-
if let Some(ref self_last) = partial.last_value {
407+
if let Some(self_last) = &partial.last_value {
408408
if !self_last.is_null() && !value.is_null() {
409409
let boundary_ok = if partial.strict {
410410
*self_last < value
@@ -436,7 +436,7 @@ impl AggregateFnVTable for IsSorted {
436436

437437
// Check boundary with previous chunk.
438438
let first_value = array_ref.execute_scalar(0, ctx)?.into_nullable();
439-
if let Some(ref self_last) = partial.last_value {
439+
if let Some(self_last) = &partial.last_value {
440440
if !self_last.is_null() && !first_value.is_null() {
441441
let boundary_ok = if partial.strict {
442442
*self_last < first_value

vortex-array/src/aggregate_fn/fns/min_max/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn min_max(array: &ArrayRef, ctx: &mut ExecutionCtx) -> VortexResult<Option<
7979
let result = MinMaxResult::from_scalar(result_scalar)?;
8080

8181
// Cache the computed min/max as statistics.
82-
if let Some(ref r) = result {
82+
if let Some(r) = &result {
8383
if let Some(min_value) = r.min.value() {
8484
array
8585
.statistics()

vortex-array/src/arrays/dict/take.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ where
100100
return Ok(Some(result));
101101
}
102102
let result = <V as TakeReduce>::take(array, parent.codes())?;
103-
if let Some(ref taken) = result {
103+
if let Some(taken) = &result {
104104
propagate_take_stats(array.array(), taken, parent.codes())?;
105105
}
106106
Ok(result)
@@ -131,7 +131,7 @@ where
131131
return Ok(Some(result));
132132
}
133133
let result = <V as TakeExecute>::take(array, parent.codes(), ctx)?;
134-
if let Some(ref taken) = result {
134+
if let Some(taken) = &result {
135135
propagate_take_stats(array.array(), taken, parent.codes())?;
136136
}
137137
Ok(result)

vortex-cuda/src/dynamic_dispatch/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ mod tests {
19421942
)?
19431943
.into_array();
19441944

1945-
let (array, base_offset) = if let Some(ref range) = slice_range {
1945+
let (array, base_offset) = if let Some(range) = &slice_range {
19461946
(encoded.slice(range.clone())?, range.start)
19471947
} else {
19481948
(encoded, 0)
@@ -2696,7 +2696,7 @@ mod tests {
26962696
)?
26972697
.into_array();
26982698

2699-
let (array, base_offset) = if let Some(ref range) = slice_range {
2699+
let (array, base_offset) = if let Some(range) = &slice_range {
27002700
(encoded.slice(range.clone())?, range.start)
27012701
} else {
27022702
(encoded, 0)

vortex-datafusion/src/persistent/source.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,13 @@ impl FileSource for VortexSource {
373373
fn fmt_extra(&self, t: DisplayFormatType, f: &mut Formatter) -> std::fmt::Result {
374374
match t {
375375
DisplayFormatType::Default | DisplayFormatType::Verbose => {
376-
if let Some(ref predicate) = self.vortex_predicate {
376+
if let Some(predicate) = &self.vortex_predicate {
377377
write!(f, ", predicate: {predicate}")?;
378378
}
379379
}
380380
// Use TreeRender style key=value formatting to display the predicate
381381
DisplayFormatType::TreeRender => {
382-
if let Some(ref predicate) = self.vortex_predicate {
382+
if let Some(predicate) = &self.vortex_predicate {
383383
writeln!(f, "predicate={}", fmt_sql(predicate.as_ref()))?;
384384
};
385385
}

vortex-datafusion/src/v2/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ impl DataSource for VortexDataSource {
467467
"VortexScanSource: projection={}",
468468
self.projected_projection
469469
)?;
470-
if let Some(ref filter) = self.filter {
470+
if let Some(filter) = &self.filter {
471471
write!(f, ", filter={filter}")?;
472472
}
473473
if let Some(limit) = self.limit {

0 commit comments

Comments
 (0)