Skip to content
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

refactor(rust): Apply clippy:assigning_clones lint #14999

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/polars-core/src/chunked_array/logical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub struct Logical<Logical: PolarsDataType, Physical: PolarsDataType>(
impl<K: PolarsDataType, T: PolarsDataType> Clone for Logical<K, T> {
fn clone(&self) -> Self {
let mut new = Logical::<K, _>::new_logical(self.0.clone());
new.2 = self.2.clone();
new.2.clone_from(&self.2);
new
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-core/src/chunked_array/ops/append.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::series::IsSorted;
pub(crate) fn new_chunks(chunks: &mut Vec<ArrayRef>, other: &[ArrayRef], len: usize) {
// Replace an empty array.
if chunks.len() == 1 && len == 0 {
*chunks = other.to_owned();
other.clone_into(chunks);
} else {
for chunk in other {
if chunk.len() > 0 {
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-core/src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ impl DataFrame {
"unable to append to a DataFrame of width {} with a DataFrame of width {}",
self.width(), other.width(),
);
self.columns = other.columns.clone();
self.columns.clone_from(&other.columns);
return Ok(self);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/polars-lazy/src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ impl JoinBuilder {
/// The passed expressions must be valid in both `LazyFrame`s in the join.
pub fn on<E: AsRef<[Expr]>>(mut self, on: E) -> Self {
let on = on.as_ref().to_vec();
self.left_on = on.clone();
self.left_on.clone_from(&on);
self.right_on = on;
self
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl AggregateFn for FirstAgg {
fn combine(&mut self, other: &dyn Any) {
let other = unsafe { other.downcast_ref::<Self>().unwrap_unchecked_release() };
if other.first.is_some() && other.chunk_idx < self.chunk_idx {
self.first = other.first.clone();
self.first.clone_from(&other.first);
self.chunk_idx = other.chunk_idx;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl AggregateFn for LastAgg {
fn combine(&mut self, other: &dyn Any) {
let other = unsafe { other.downcast_ref::<Self>().unwrap_unchecked_release() };
if other.last.is_some() && other.chunk_idx >= self.chunk_idx {
self.last = other.last.clone();
self.last.clone_from(&other.last);
self.chunk_idx = other.chunk_idx;
};
}
Expand Down
Loading