From d4f77deaf0e6f1ff469160f8748c3af7b4211e1b Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Tue, 3 Mar 2026 07:16:32 -0500 Subject: [PATCH] chore: Enable `assigning_clones` clippy lint --- Cargo.toml | 1 + datafusion/common/src/config.rs | 10 ++-------- datafusion/physical-plan/src/aggregates/mod.rs | 2 +- datafusion/physical-plan/src/display.rs | 13 +++++++------ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3bcf17d8ed657..ecedf376fd3bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -208,6 +208,7 @@ inefficient_to_string = "warn" needless_pass_by_value = "warn" # https://github.com/apache/datafusion/issues/18881 allow_attributes = "warn" +assigning_clones = "warn" [workspace.lints.rust] unexpected_cfgs = { level = "warn", check-cfg = [ diff --git a/datafusion/common/src/config.rs b/datafusion/common/src/config.rs index d71af206c78d5..7238d842e39ab 100644 --- a/datafusion/common/src/config.rs +++ b/datafusion/common/src/config.rs @@ -2711,10 +2711,7 @@ impl From<&Arc> for ConfigFileEncryptionProperties { }, ); } - let mut aad_prefix: Vec = Vec::new(); - if let Some(prefix) = f.aad_prefix() { - aad_prefix = prefix.clone(); - } + let aad_prefix = f.aad_prefix().cloned().unwrap_or_default(); ConfigFileEncryptionProperties { encrypt_footer: f.encrypt_footer(), footer_key_as_hex: hex::encode(f.footer_key()), @@ -2852,10 +2849,7 @@ impl From<&Arc> for ConfigFileDecryptionProperties { column_decryption_properties.insert(column_name.clone(), props); } - let mut aad_prefix: Vec = Vec::new(); - if let Some(prefix) = f.aad_prefix() { - aad_prefix = prefix.clone(); - } + let aad_prefix = f.aad_prefix().cloned().unwrap_or_default(); ConfigFileDecryptionProperties { footer_key_as_hex: hex::encode( f.footer_key(None).unwrap_or_default().as_ref(), diff --git a/datafusion/physical-plan/src/aggregates/mod.rs b/datafusion/physical-plan/src/aggregates/mod.rs index 561e9d1d05e89..b9a1e49ab5220 100644 --- a/datafusion/physical-plan/src/aggregates/mod.rs +++ b/datafusion/physical-plan/src/aggregates/mod.rs @@ -1429,7 +1429,7 @@ impl ExecutionPlan for AggregateExec { Arc::clone(&self.schema), )?; me.limit_options = self.limit_options; - me.dynamic_filter = self.dynamic_filter.clone(); + me.dynamic_filter.clone_from(&self.dynamic_filter); Ok(Arc::new(me)) } diff --git a/datafusion/physical-plan/src/display.rs b/datafusion/physical-plan/src/display.rs index c69ac03178485..76dd6f2054b5a 100644 --- a/datafusion/physical-plan/src/display.rs +++ b/datafusion/physical-plan/src/display.rs @@ -734,13 +734,14 @@ impl TreeRenderVisitor<'_, '_> { if let Some(node) = root.get_node(x, y) { write!(self.f, "{}", Self::VERTICAL)?; - // Rigure out what to render. - let mut render_text = String::new(); - if render_y == 0 { - render_text = node.name.clone(); + // Figure out what to render. + let mut render_text = if render_y == 0 { + node.name.clone() } else if render_y <= extra_info[x].len() { - render_text = extra_info[x][render_y - 1].clone(); - } + extra_info[x][render_y - 1].clone() + } else { + String::new() + }; render_text = Self::adjust_text_for_rendering( &render_text,