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

Use cloned_from() instead of clone() in app.rs #71

Merged
merged 1 commit into from
Jul 28, 2024
Merged

Conversation

jfernandez
Copy link
Contributor

@jfernandez jfernandez commented Jul 28, 2024

To silence the clippy warning:

warning: assigning the result of `Clone::clone()` may be inefficient
   --> src/app.rs:279:9
    |
279 |         *self.graphs_bpf_program.lock().unwrap() = self.selected_program().clone();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.graphs_bpf_program.lock().unwrap().clone_from(&self.selected_program())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
    = note: `#[warn(clippy::assigning_clones)]` on by default

This change is to fix the clippy warning:

warning: assigning the result of `Clone::clone()` may be inefficient
   --> src/app.rs:279:9
    |
279 |         *self.graphs_bpf_program.lock().unwrap() = self.selected_program().clone();
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.graphs_bpf_program.lock().unwrap().clone_from(&self.selected_program())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
    = note: `#[warn(clippy::assigning_clones)]` on by default

Signed-off-by: Jose Fernandez <josef@netflix.com>
@jfernandez jfernandez changed the title Use cloned_into() instead of clone() in app.rs Use cloned_from() instead of clone() in app.rs Jul 28, 2024
@jfernandez jfernandez merged commit e16dcc0 into main Jul 28, 2024
3 checks passed
@jfernandez jfernandez deleted the clippy-fix branch July 28, 2024 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant