diff options
author | cyqsimon <28627918+cyqsimon@users.noreply.github.com> | 2024-03-25 13:42:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-25 13:42:17 +0800 |
commit | 451daea0aca8c241c6cc3e33aabf5aed57ddd0e8 (patch) | |
tree | db2df4215f65000fb73af6c77b717940686a32c7 /src | |
parent | 32506e7f245171b43b22df1bda7fbcfcc7717f3e (diff) |
Apply suggestions from new clippy lint `clippy::assigning_clones` (#382)
* fix: clippy warnings
* Additional fix
* Write changelog
---------
Co-authored-by: Krithic Kumar <krithickumarub@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/display/ui.rs | 2 | ||||
-rw-r--r-- | src/display/ui_state.rs | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/display/ui.rs b/src/display/ui.rs index e9df82d..7f7994c 100644 --- a/src/display/ui.rs +++ b/src/display/ui.rs @@ -33,7 +33,7 @@ where terminal.hide_cursor().unwrap(); let state = { let mut state = UIState::default(); - state.interface_name = opts.interface.clone(); + state.interface_name.clone_from(&opts.interface); state.unit_family = opts.render_opts.unit_family.into(); state.cumulative_mode = opts.render_opts.total_utilization; state diff --git a/src/display/ui_state.rs b/src/display/ui_state.rs index e01bbf3..95aa9d2 100644 --- a/src/display/ui_state.rs +++ b/src/display/ui_state.rs @@ -129,7 +129,9 @@ impl UIState { .or_default(); connection_data.total_bytes_downloaded += connection_info.total_bytes_downloaded; connection_data.total_bytes_uploaded += connection_info.total_bytes_uploaded; - connection_data.interface_name = connection_info.interface_name.clone(); + connection_data + .interface_name + .clone_from(&connection_info.interface_name); data_for_remote_address.total_bytes_downloaded += connection_info.total_bytes_downloaded; data_for_remote_address.total_bytes_uploaded += @@ -179,7 +181,7 @@ impl UIState { let proc_info = proc_info .cloned() .unwrap_or_else(|| ProcessInfo::new("<UNKNOWN>", 0)); - connection_data.process_name = proc_info.name.clone(); + connection_data.process_name.clone_from(&proc_info.name); processes.entry(proc_info).or_default() }; |