This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 29e849519e chore: Enable `assigning_clones` clippy lint (#20670)
29e849519e is described below
commit 29e849519ef8f9deda5ad5509cd2bf49acc0029c
Author: Neil Conway <[email protected]>
AuthorDate: Thu Mar 5 09:25:58 2026 -0500
chore: Enable `assigning_clones` clippy lint (#20670)
## Which issue does this PR close?
N/A
## Rationale for this change
The `assigning_clones` clippy lint seems marginally useful. Enabling it
for the whole workspace only catches a few places, but they are all
coding patterns that could be improved.
## What changes are included in this PR?
- Enable `assigning_clones` clippy lint as a workspace-level warning
- Fix existing lint violations (no false positives)
## Are these changes tested?
Yes, covered by existing tests. This is a mechanical refactor that does
not change behavior.
## Are there any user-facing changes?
No.
---
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 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/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 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.rs
index 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.rs
index 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,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]