Skip to content

Commit e0bc6dd

Browse files
committed
More clippy errors
1 parent 0fd1a1e commit e0bc6dd

7 files changed

Lines changed: 9 additions & 9 deletions

File tree

datafusion/ffi/src/udwf/partition_evaluator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub struct PartitionEvaluatorPrivateData {
8686
}
8787

8888
impl FFI_PartitionEvaluator {
89-
unsafe fn inner_mut(&mut self) -> &mut Box<(dyn PartitionEvaluator + 'static)> {
89+
unsafe fn inner_mut(&mut self) -> &mut Box<dyn PartitionEvaluator + 'static> {
9090
let private_data = self.private_data as *mut PartitionEvaluatorPrivateData;
9191
&mut (*private_data).evaluator
9292
}

datafusion/functions-aggregate/src/average.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ impl<T: DecimalType + ArrowNumericType + Debug> Accumulator for DecimalAvgAccumu
405405
self.count += (values.len() - values.null_count()) as u64;
406406

407407
if let Some(x) = sum(values) {
408-
let v = self.sum.get_or_insert(T::Native::default());
408+
let v = self.sum.get_or_insert_with(T::Native::default);
409409
self.sum = Some(v.add_wrapping(x));
410410
}
411411
Ok(())
@@ -450,7 +450,7 @@ impl<T: DecimalType + ArrowNumericType + Debug> Accumulator for DecimalAvgAccumu
450450

451451
// sums are summed
452452
if let Some(x) = sum(states[1].as_primitive::<T>()) {
453-
let v = self.sum.get_or_insert(T::Native::default());
453+
let v = self.sum.get_or_insert_with(T::Native::default);
454454
self.sum = Some(v.add_wrapping(x));
455455
}
456456
Ok(())

datafusion/functions-aggregate/src/bit_and_or_xor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ where
382382
{
383383
fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
384384
if let Some(x) = arrow::compute::bit_or(values[0].as_primitive::<T>()) {
385-
let v = self.value.get_or_insert(T::Native::usize_as(0));
385+
let v = self.value.get_or_insert_with(|| T::Native::usize_as(0));
386386
*v = *v | x;
387387
}
388388
Ok(())
@@ -427,7 +427,7 @@ where
427427
{
428428
fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
429429
if let Some(x) = arrow::compute::bit_xor(values[0].as_primitive::<T>()) {
430-
let v = self.value.get_or_insert(T::Native::usize_as(0));
430+
let v = self.value.get_or_insert_with(|| T::Native::usize_as(0));
431431
*v = *v ^ x;
432432
}
433433
Ok(())

datafusion/functions-aggregate/src/sum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ impl<T: ArrowNumericType> Accumulator for SumAccumulator<T> {
314314
fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
315315
let values = values[0].as_primitive::<T>();
316316
if let Some(x) = arrow::compute::sum(values) {
317-
let v = self.sum.get_or_insert(T::Native::usize_as(0));
317+
let v = self.sum.get_or_insert_with(|| T::Native::usize_as(0));
318318
*v = v.add_wrapping(x);
319319
}
320320
Ok(())

datafusion/physical-plan/src/joins/sort_merge_join/exec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ impl DisplayAs for SortMergeJoinExec {
356356
"SortMergeJoin: join_type={:?}, on=[{}]{}",
357357
self.join_type,
358358
on,
359-
self.filter.as_ref().map_or("".to_string(), |f| format!(
359+
self.filter.as_ref().map_or_else(|| "".to_string(), |f| format!(
360360
", filter={}",
361361
f.expression()
362362
))

datafusion/physical-plan/src/limit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl DisplayAs for GlobalLimitExec {
105105
f,
106106
"GlobalLimitExec: skip={}, fetch={}",
107107
self.skip,
108-
self.fetch.map_or("None".to_string(), |x| x.to_string())
108+
self.fetch.map_or_else(|| "None".to_string(), |x| x.to_string())
109109
)
110110
}
111111
DisplayFormatType::TreeRender => {

datafusion/spark/src/function/string/luhn_check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,5 @@ fn luhn_check_impl(input: &str) -> bool {
149149
alt = !alt;
150150
}
151151

152-
digits_processed > 0 && sum % 10 == 0
152+
digits_processed > 0 && sum.is_multiple_of(10)
153153
}

0 commit comments

Comments
 (0)