-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor: consistently apply clippy::clone_on_ref_ptr
in all crates
#15284
Conversation
@@ -145,7 +145,7 @@ impl From<&dyn Session> for TaskContext { | |||
state.scalar_functions().clone(), | |||
state.aggregate_functions().clone(), | |||
state.window_functions().clone(), | |||
state.runtime_env().clone(), | |||
Arc::clone(state.runtime_env()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shows what the lint disallows -- when it is an Arc
it must use Arc::clone
rather than .clone()
so it is easier to see when reading the code that no copies are made
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always wondered what the motivation of the lint is 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good point -- I'll add some comments explaining it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm thanks @alamb not sure why CI failed though
Which issue does this PR close?
Rationale for this change
Some of the newer DataFusion crates don't have the
clippy::clone_on_ref_ptr
lint enabled. This lint is present to make it clear whenclone()
is very cheap (because it is on an Arc rather than some structure that requires deep copyingWhat changes are included in this PR?
Here is an example of the lint enabled in the core crate
datafusion/datafusion/core/src/lib.rs
Line 24 in 5224194
Are these changes tested?
By CI
Are there any user-facing changes?
No