Apache DataFusion SQL Query Engine
chore: Enable `assigning_clones` clippy lint (#20670)
Neil Conway29e849519ef8
diff --git a/Cargo.toml b/Cargo.tomlindex d057261f7a..7aa959702d 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/18881allow_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.rsindex d71af206c7..7238d842e3 100644--- a/datafusion/common/src/config.rs+++ b/datafusion/common/src/config.rs@@ -2711,10 +2711,7 @@ impl From<&Arc<FileEncryptionProperties>> for ConfigFileEncryptionProperties {},);}- let mut aad_prefix: Vec<u8> = 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<FileDecryptionProperties>> for ConfigFileDecryptionProperties {column_decryption_properties.insert(column_name.clone(), props);}- let mut aad_prefix: Vec<u8> = 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.rsindex 561e9d1d05..b9a1e49ab5 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.rsindex c69ac03178..76dd6f2054 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,