Skip to content

Commit 433b1e5

Browse files
committed
chore: Fix clippy
1 parent fee90be commit 433b1e5

6 files changed

Lines changed: 13 additions & 6 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ needless_pass_by_value = "warn"
212212
# https://github.com/apache/datafusion/issues/18881
213213
allow_attributes = "warn"
214214
assigning_clones = "warn"
215+
# ScalarValue and Expr contain Arc<..> with interior mutability but are
216+
# intentionally used as hash keys throughout the codebase.
217+
mutable_key_type = "allow"
215218

216219
[workspace.lints.rust]
217220
unexpected_cfgs = { level = "warn", check-cfg = [

datafusion-cli/tests/cli_integration.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,12 @@ fn test_backtrace_output(#[case] query: &str) {
414414
let output = cmd.output().expect("Failed to execute command");
415415
let stdout = String::from_utf8_lossy(&output.stdout);
416416
let stderr = String::from_utf8_lossy(&output.stderr);
417-
let combined_output = format!("{}{}", stdout, stderr);
417+
let combined_output = format!("{stdout}{stderr}");
418418

419419
// Assert that the output includes literal 'backtrace'
420420
assert!(
421421
combined_output.to_lowercase().contains("backtrace"),
422-
"Expected output to contain 'backtrace', but got stdout: '{}' stderr: '{}'",
423-
stdout,
424-
stderr
422+
"Expected output to contain 'backtrace', but got stdout: '{stdout}' stderr: '{stderr}'"
425423
);
426424
}
427425

datafusion/common/src/error.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,6 @@ mod test {
12741274
// To pass the test the environment variable RUST_BACKTRACE should be set to 1 to enforce backtrace
12751275
#[cfg(feature = "backtrace")]
12761276
#[test]
1277-
#[expect(clippy::unnecessary_literal_unwrap)]
12781277
fn test_enabled_backtrace() {
12791278
match std::env::var("RUST_BACKTRACE") {
12801279
Ok(val) if val == "1" => {}

datafusion/common/src/hash_utils.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919
2020
use arrow::array::types::{IntervalDayTime, IntervalMonthDayNano};
2121
use arrow::array::*;
22+
#[cfg(not(feature = "force_hash_collisions"))]
2223
use arrow::compute::take;
2324
use arrow::datatypes::*;
2425
#[cfg(not(feature = "force_hash_collisions"))]
2526
use arrow::{downcast_dictionary_array, downcast_primitive_array};
2627
use foldhash::fast::FixedState;
28+
#[cfg(not(feature = "force_hash_collisions"))]
2729
use itertools::Itertools;
30+
#[cfg(not(feature = "force_hash_collisions"))]
2831
use std::collections::HashMap;
2932
use std::hash::{BuildHasher, Hash, Hasher};
3033

@@ -198,6 +201,7 @@ hash_float_value!((half::f16, u16), (f32, u32), (f64, u64));
198201
/// Create a `SeedableRandomState` whose per-hasher seed incorporates `seed`.
199202
/// This folds the previous hash into the hasher's initial state so only the
200203
/// new value needs to pass through the hash function — same cost as `hash_one`.
204+
#[cfg(not(feature = "force_hash_collisions"))]
201205
#[inline]
202206
fn seeded_state(seed: u64) -> foldhash::fast::SeedableRandomState {
203207
foldhash::fast::SeedableRandomState::with_seed(
@@ -303,6 +307,7 @@ fn hash_array<T>(
303307
/// HAS_NULLS: do we have to check null in the inner loop
304308
/// HAS_BUFFERS: if true, array has external buffers; if false, all strings are inlined/ less then 12 bytes
305309
/// REHASH: if true, combining with existing hash, otherwise initializing
310+
#[cfg(not(feature = "force_hash_collisions"))]
306311
#[inline(never)]
307312
fn hash_string_view_array_inner<
308313
T: ByteViewType,
@@ -429,6 +434,7 @@ fn hash_generic_byte_view_array<T: ByteViewType>(
429434
/// - `HAS_NULL_KEYS`: Whether to check for null dictionary keys
430435
/// - `HAS_NULL_VALUES`: Whether to check for null dictionary values
431436
/// - `MULTI_COL`: Whether to combine with existing hash (true) or initialize (false)
437+
#[cfg(not(feature = "force_hash_collisions"))]
432438
#[inline(never)]
433439
fn hash_dictionary_inner<
434440
K: ArrowDictionaryKeyType,

datafusion/execution/src/memory_pool/arrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl arrow_buffer::MemoryReservation for MemoryReservation {
5959
impl arrow_buffer::MemoryPool for ArrowMemoryPool {
6060
fn reserve(&self, size: usize) -> Box<dyn arrow_buffer::MemoryReservation> {
6161
let consumer = self.consumer.clone_with_new_id();
62-
let mut reservation = consumer.register(&self.inner);
62+
let reservation = consumer.register(&self.inner);
6363
reservation.grow(size);
6464

6565
Box::new(reservation)

datafusion/physical-plan/src/aggregates/group_values/single_group_by/primitive.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use datafusion_execution::memory_pool::proxy::VecAllocExt;
2828
use datafusion_expr::EmitTo;
2929
use half::f16;
3030
use hashbrown::hash_table::HashTable;
31+
#[cfg(not(feature = "force_hash_collisions"))]
3132
use std::hash::BuildHasher;
3233
use std::mem::size_of;
3334
use std::sync::Arc;

0 commit comments

Comments
 (0)