Skip to content

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

Merged
jfernandez merged 1 commit into
mainfrom
clippy-fix
Jul 28, 2024
Merged

Use cloned_from() instead of clone() in app.rs#71
jfernandez merged 1 commit into
mainfrom
clippy-fix

Conversation

@jfernandez
Copy link
Copy Markdown
Owner

@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
@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