Skip to content

Commit

Permalink
Use clonde_from() instead of clone() in app.rs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jfernandez committed Jul 28, 2024
1 parent c1ad1c9 commit 1988970
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ impl App {
self.max_eps = 0;
self.max_runtime = 0;
self.mode = Mode::Graph;
*self.graphs_bpf_program.lock().unwrap() = self.selected_program().clone();

self.graphs_bpf_program.lock().unwrap().clone_from(&self.selected_program());
}

pub fn show_table(&mut self) {
Expand Down

0 comments on commit 1988970

Please sign in to comment.