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

Conversation

jqnatividad
Copy link
Contributor

warning: assigning the result of ToOwned::to_owned() may be inefficient
--> crates/polars-core/src/chunked_array/ops/append.rs:7:9
|
7 | *chunks = other.to_owned();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use clone_into(): other.clone_into(chunks)
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
= note: -W clippy::assigning-clones implied by -W clippy::perf
= help: to override -W clippy::perf add #[allow(clippy::assigning_clones)]

warning: assigning the result of Clone::clone() may be inefficient
--> crates/polars-core/src/chunked_array/logical/mod.rs:47:9
|
47 | new.2 = self.2.clone();
| ^^^^^^^^^^^^^^^^^^^^^^ help: use clone_from(): new.2.clone_from(&self.2)
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones

warning: assigning the result of Clone::clone() may be inefficient
--> crates/polars-core/src/frame/mod.rs:936:13
|
936 | self.columns = other.columns.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use clone_from(): self.columns.clone_from(&other.columns)
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones

warning: polars-plan (lib) generated 6 warnings
warning: assigning the result of Clone::clone() may be inefficient
--> crates/polars-pipe/src/executors/sinks/group_by/aggregates/first.rs:58:13
|
58 | self.first = other.first.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use clone_from(): self.first.clone_from(&other.first)
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
= note: -W clippy::assigning-clones implied by -W clippy::perf
= help: to override -W clippy::perf add #[allow(clippy::assigning_clones)]

warning: assigning the result of Clone::clone() may be inefficient
--> crates/polars-pipe/src/executors/sinks/group_by/aggregates/last.rs:55:13
|
55 | self.last = other.last.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use clone_from(): self.last.clone_from(&other.last)
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones

warning: polars-pipe (lib) generated 2 warnings (run cargo clippy --fix --lib -p polars-pipe to apply 2 suggestions) warning: assigning the result of Clone::clone() may be inefficient
--> crates/polars-lazy/src/frame/mod.rs:1945:9
|
1945 | self.left_on = on.clone();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use clone_from(): self.left_on.clone_from(&on)
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
= note: -W clippy::assigning-clones implied by -W clippy::perf
= help: to override -W clippy::perf add #[allow(clippy::assigning_clones)]

warning: assigning the result of `ToOwned::to_owned()` may be inefficient
 --> crates/polars-core/src/chunked_array/ops/append.rs:7:9
  |
7 |         *chunks = other.to_owned();
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_into()`: `other.clone_into(chunks)`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
  = note: `-W clippy::assigning-clones` implied by `-W clippy::perf`
  = help: to override `-W clippy::perf` add `#[allow(clippy::assigning_clones)]`

warning: assigning the result of `Clone::clone()` may be inefficient
  --> crates/polars-core/src/chunked_array/logical/mod.rs:47:9
   |
47 |         new.2 = self.2.clone();
   |         ^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `new.2.clone_from(&self.2)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones

warning: assigning the result of `Clone::clone()` may be inefficient
   --> crates/polars-core/src/frame/mod.rs:936:13
    |
936 |             self.columns = other.columns.clone();
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.columns.clone_from(&other.columns)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones

warning: `polars-plan` (lib) generated 6 warnings
warning: assigning the result of `Clone::clone()` may be inefficient
  --> crates/polars-pipe/src/executors/sinks/group_by/aggregates/first.rs:58:13
   |
58 |             self.first = other.first.clone();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.first.clone_from(&other.first)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
   = note: `-W clippy::assigning-clones` implied by `-W clippy::perf`
   = help: to override `-W clippy::perf` add `#[allow(clippy::assigning_clones)]`

warning: assigning the result of `Clone::clone()` may be inefficient
  --> crates/polars-pipe/src/executors/sinks/group_by/aggregates/last.rs:55:13
   |
55 |             self.last = other.last.clone();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.last.clone_from(&other.last)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones

warning: `polars-pipe` (lib) generated 2 warnings (run `cargo clippy --fix --lib -p polars-pipe` to apply 2 suggestions)
warning: assigning the result of `Clone::clone()` may be inefficient
    --> crates/polars-lazy/src/frame/mod.rs:1945:9
     |
1945 |         self.left_on = on.clone();
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.left_on.clone_from(&on)`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
     = note: `-W clippy::assigning-clones` implied by `-W clippy::perf`
     = help: to override `-W clippy::perf` add `#[allow(clippy::assigning_clones)]`
Copy link

codecov bot commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.99%. Comparing base (c5b53ab) to head (7b3307f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14999   +/-   ##
=======================================
  Coverage   80.98%   80.99%           
=======================================
  Files        1333     1333           
  Lines      173174   173174           
  Branches     2458     2458           
=======================================
+ Hits       140252   140254    +2     
+ Misses      32454    32452    -2     
  Partials      468      468           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stinodego stinodego changed the title clippy:assigning_clones refactor(rust): Apply clippy:assigning_clones lint Mar 12, 2024
@github-actions github-actions bot added internal An internal refactor or improvement rust Related to Rust Polars labels Mar 12, 2024
Copy link
Member

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ritchie46 ritchie46 merged commit 2313b9d into pola-rs:main Mar 12, 2024
20 checks passed
@jqnatividad jqnatividad deleted the clippy-assigning_clones branch March 12, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants